Skip to content

Commit

Permalink
net: lib: http_server: Clear http1_headers_sent flag on new request
Browse files Browse the repository at this point in the history
http1_headers_sent flag has to be cleared when entering
HTTP_SERVER_REQUEST_STATE and not only on the client init. Otherwise,
serving multiple HTTP1 POST requests over the same connection does not
work as intended (headers were not sent for the second and further
requests).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 086faa5)
  • Loading branch information
rlubos authored and nashif committed Aug 18, 2024
1 parent 6c4d9e0 commit 20e7ef3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions subsys/net/lib/http/http_server_http1.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ int enter_http1_request(struct http_client_ctx *client)
client->parser_settings.on_body = on_body;
client->parser_settings.on_message_complete = on_message_complete;
client->parser_state = HTTP1_INIT_HEADER_STATE;
client->http1_headers_sent = false;

memset(client->header_buffer, 0, sizeof(client->header_buffer));
memset(client->url_buffer, 0, sizeof(client->url_buffer));
Expand Down

0 comments on commit 20e7ef3

Please sign in to comment.