lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Get POST data from a netbuf (Netconn API)


From: clement.deleurence
Subject: [lwip-users] Get POST data from a netbuf (Netconn API)
Date: Mon, 1 Aug 2016 05:00:40 -0700 (MST)

Hi everyone,

I'm currently working with the Netconn API, trying to develop a web server
which will handle GET and POST requests (in order to get/modify values of
variables on my Stellaris).

The web server is working fine, i'm able to send GET requests (with Chrome
browser) on the web server embedded on the Stellaris. 
However, i don't know how to get POST data sent from my browser to the
server.

I tried this so far (simplified version obviously) :

*struct netbuf *inbuf;
u16_t buflen;
char *buf;

netbuf_data(inbuf, (void*)&buf, &buflen);*

With the code shows above, i get this in *buf*: 

POST /WebService/HelloWorld HTTP/1.1 
[...]
Content-Length: 15 
[...]
Content-Type: application/x-www-form-urlencoded
[...]
Accept-Encoding: gzip, deflate Accept-Language:
fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4


I read severals times that POST data are appended to the request header,
after a double newline.
However, i have nothing more to read than what you see above in *buf*.

So, i thought that POST data may be located in the next fragment of my
netbuf but after checking with the function *netbuf_next*, it appeared that
there is no more fragments in the netbuf.

I even tried to get all the netbuf with the function *netbuf_copy* (which
"Copies all of the data from the netbuf buf into the memory pointed to by
data even if the netbuf buf is fragmented") and i only get this :

POST /WebService/HelloWorld HTTP/1.1 
[...]
Content-Length: 15 
[...]
Content-Type: application/x-www-form-urlencoded
[...]
Accept-Encoding: gzip, deflate Accept-Language:
fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4

The first and single fragment...

So, as i'm really struggling with POST request, I'm asking if the Netconn
API can handle POST request or if I made mistakes.

Thanks for help! 



--
View this message in context: 
http://lwip.100.n7.nabble.com/Get-POST-data-from-a-netbuf-Netconn-API-tp26952.html
Sent from the lwip-users mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]