0

I'm trying to get some C code going on an embedded board running FreeRTOS and using its TCP/IP stack to POST a very simple file to an Apache server running on my desktop.

I can pull a file from the Apache server to my board just fine, so I know the Apache server is running. enter image description here

I have attached a Wireshark screenshot of the HTTP POST packet that goes out from my embedded board. You can see the hex values of the exact message at the bottom.

I then send another TCP packet out with the twenty bytes of data. I have tried that and attaching those twenty bytes of data to the same packet the header is in. In both cases I get a couple of packets back from the desktop outlining the error. It tells me there a 404 error which I found on one site means:

HTTP/1.1 404 Not Found

The POST path of a command is incorrect.

The index.html file on the Apache server is in my /var/www/html/ directory. I created an incoming subdirectory and gave it full permissions for everyone.

drwxrwxrwx 2 root root 4096 Nov 19 10:07 incoming/ -rw-r--r-- 1 root root 174 Nov 11 22:20 index.html

So, I believe anyone should be able to post to that incoming address. As I request /index.html in the GET command, I believe the request:

POST /incoming/records.txt

Should be the correct path.

Is anyone able to advise on why this could be wrong please?

I guess it could be:

  1. An incorrect POST command
  2. An incorrect Apache setup

I suspect the reason the Apache server is resending its last packet is because I have not sent an ACK back when it sent me the 404 error. I will try to sort that out in parallel.

WFIW I am using Berkeley sockets in the stack to send and receive information.

Many thanks!

DiBosco
  • 838
  • 8
  • 21
  • If I actually put the file records.txt in the incoming/ directory, I get an HTTP/1.1 200 OK reply from the Apache server, but nothing gets written to that file on the hard drive. I must be missing something pretty fundamental here! – DiBosco Nov 19 '14 at 13:26
  • Did you try to post to the server from another computer (other than the embedded board)? – kums Nov 19 '14 at 14:25
  • No, I wouldn't have the first idea how to do that. Other than maybe knock up some Qt Code and I'd end up sending exactly the same message. Unless, thinking about it, there is a POST function built into Qt. – DiBosco Nov 19 '14 at 15:16
  • I don't think you need to involve QT here. You can use something like [curl](http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request) from your desktop and find if it is successful. If this works, you know your Apache configuration is OK and the issue is something else. – kums Nov 19 '14 at 15:41
  • Thanks, I'll investigate and see if I can get it to work with my laptop. – DiBosco Nov 19 '14 at 15:50
  • I'm beginning to wonder whether this is even possible unless you have some sort of programme running on the Apache server to take the passed file and *do* something with it. I had assumed you could just write a file to the server, but am no longer convinced. Cannot make head or tail of curl. – DiBosco Nov 19 '14 at 17:41

0 Answers0