Skip to content

Commit 4063913

Browse files
rluboskartben
authored andcommitted
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 <[email protected]>
1 parent 4178ede commit 4063913

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

subsys/net/lib/http/http_server_http2.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ static int send_headers_frame(struct http_client_ctx *client, enum http_status s
208208
return ret;
209209
}
210210

211+
client->current_stream->headers_sent = true;
212+
211213
return 0;
212214
}
213215

@@ -377,8 +379,6 @@ static int handle_http2_static_resource(
377379
goto out;
378380
}
379381

380-
client->current_stream->headers_sent = true;
381-
382382
ret = send_data_frame(client, content_200, content_len,
383383
frame->stream_identifier,
384384
HTTP2_FLAG_END_STREAM);
@@ -465,8 +465,6 @@ static int handle_http2_static_fs_resource(struct http_resource_detail_static_fs
465465
goto out;
466466
}
467467

468-
client->current_stream->headers_sent = true;
469-
470468
/* read and send file */
471469
remaining = client->data_len;
472470
while (remaining > 0) {
@@ -535,8 +533,6 @@ static int http2_dynamic_response(struct http_client_ctx *client, struct http2_f
535533
if (ret < 0) {
536534
return ret;
537535
}
538-
539-
client->current_stream->headers_sent = true;
540536
}
541537

542538
/* Send body data if provided */

0 commit comments

Comments
 (0)