lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Post messages with the httpd.c example


From: Trampas Stern
Subject: [lwip-users] Post messages with the httpd.c example
Date: Tue, 21 Jan 2020 15:18:37 -0500

I was trying to use the httpd.c example which does some POST data parsing.  From the httpd.h file it appears that httpd_post_begin() function is called with the first packet of data.  However in reality it appears in use that it is usually called with just the POST header.  
Since I assume the POST header could span multiple packets I assumed that the  httpd_post_begin() may not have the complete header but might just be first packet in the header.  
Therefore in my implementation of  httpd_post_begin() and httpd_post_receive_data() I was scanning for the double-CRLF to determine the end of the header and start of data. 
What I found is that the "\r\n\r\n" was actually "\0\n\r\n".  Looking through the http_post_request() code it appears that the code is putting the '\0' in the data:

/* trim http header */
*crlfcrlf = 0;
err = httpd_post_begin(hs, uri, hdr_start_after_uri,
hdr_data_len, content_len, http_uri_buf,
LWIP_HTTPD_URI_BUF_LEN, &post_auto_wnd);

Is this an error?   Specifically if the  httpd_post_begin() is not guaranteed to be sent with the full header for the POST then on the users application side we should be managing determining where the header ends and start of data is, and thus the httpd.c code should not be changing the data within the packet. 

Thanks
Trampas



reply via email to

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