Fix that connections are closed with RST if the HTTP requests didn't fit into the first packet (RST would be sent because not all data has been recved by the httpd - now we ensure all data has been read by waiting for the first double-CRLF before parsing the request)

This commit is contained in:
Simon Goldschmidt 2011-09-02 22:02:45 +02:00
parent 08119c678c
commit 7413328273

View File

@ -1665,8 +1665,11 @@ http_parse_request(struct pbuf **inp, struct http_state *hs, struct tcp_pcb *pcb
#endif /* LWIP_HTTPD_SUPPORT_V09 */
uri_len = sp2 - (sp1 + 1);
if ((sp2 != 0) && (sp2 > sp1)) {
/* for > 0.9, wait for double-CRLF (end of HTTP headers) before parsing
the request */
if (is_09 || strnstr(data, CRLF CRLF, data_len) != NULL) {
char *uri = sp1 + 1;
/* null-terminate the METHOD (pbuf is freed anyway wen returning) */
/* null-terminate the METHOD (pbuf is freed anyway when returning) */
*sp1 = 0;
uri[uri_len] = 0;
LWIP_DEBUGF(HTTPD_DEBUG, ("Received \"%s\" request for URI: \"%s\"\n",
@ -1694,6 +1697,7 @@ http_parse_request(struct pbuf **inp, struct http_state *hs, struct tcp_pcb *pcb
{
return http_find_file(hs, uri, is_09);
}
}
} else {
LWIP_DEBUGF(HTTPD_DEBUG, ("invalid URI\n"));
}