net: http_server: Simplify HTTP2 headers_sent flag setting

Since there is a helper function to generate/send headers frame, the
flag can be set there instead of being set separately in various places.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2025-01-10 15:47:17 +01:00 committed by Benjamin Cabé
parent 4178ede259
commit 4063913960

View File

@ -208,6 +208,8 @@ static int send_headers_frame(struct http_client_ctx *client, enum http_status s
return ret;
}
client->current_stream->headers_sent = true;
return 0;
}
@ -377,8 +379,6 @@ static int handle_http2_static_resource(
goto out;
}
client->current_stream->headers_sent = true;
ret = send_data_frame(client, content_200, content_len,
frame->stream_identifier,
HTTP2_FLAG_END_STREAM);
@ -465,8 +465,6 @@ static int handle_http2_static_fs_resource(struct http_resource_detail_static_fs
goto out;
}
client->current_stream->headers_sent = true;
/* read and send file */
remaining = client->data_len;
while (remaining > 0) {
@ -535,8 +533,6 @@ static int http2_dynamic_response(struct http_client_ctx *client, struct http2_f
if (ret < 0) {
return ret;
}
client->current_stream->headers_sent = true;
}
/* Send body data if provided */