summaryrefslogtreecommitdiffhomepage
path: root/src/http
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2025-07-24 18:29:21 +0400
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>2025-07-28 21:06:48 +0400
commit50932c3c6c1d2c442ef08241443162c7a3ed58b3 (patch)
tree8e1feda0a7a4f22f0b6637118dec8f78a9908ae3 /src/http
parent4da771108282cd233ddc37f83ba8bd01981beeb7 (diff)
downloadnginx-50932c3c6c1d2c442ef08241443162c7a3ed58b3.tar.gz
nginx-50932c3c6c1d2c442ef08241443162c7a3ed58b3.tar.bz2
HTTP/2: fixed flushing early hints over SSL.
Previously, when using HTTP/2 over SSL, an early hints HEADERS frame was queued in SSL buffer, and might not be immediately flushed. This resulted in a delay of early hints delivery until the main response was sent. The fix is to set the flush flag for the early hints HEADERS frame buffer.
Diffstat (limited to 'src/http')
-rw-r--r--src/http/v2/ngx_http_v2_filter_module.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c
index 907906a88..6b73b1e68 100644
--- a/src/http/v2/ngx_http_v2_filter_module.c
+++ b/src/http/v2/ngx_http_v2_filter_module.c
@@ -32,7 +32,8 @@ static ngx_int_t ngx_http_v2_early_hints_filter(ngx_http_request_t *r);
static ngx_int_t ngx_http_v2_init_stream(ngx_http_request_t *r);
static ngx_http_v2_out_frame_t *ngx_http_v2_create_headers_frame(
- ngx_http_request_t *r, u_char *pos, u_char *end, ngx_uint_t fin);
+ ngx_http_request_t *r, u_char *pos, u_char *end, ngx_uint_t fin,
+ ngx_uint_t flush);
static ngx_http_v2_out_frame_t *ngx_http_v2_create_trailers_frame(
ngx_http_request_t *r);
@@ -609,7 +610,7 @@ ngx_http_v2_header_filter(ngx_http_request_t *r)
fin = r->header_only
|| (r->headers_out.content_length_n == 0 && !r->expect_trailers);
- frame = ngx_http_v2_create_headers_frame(r, start, pos, fin);
+ frame = ngx_http_v2_create_headers_frame(r, start, pos, fin, 0);
if (frame == NULL) {
return NGX_ERROR;
}
@@ -774,7 +775,7 @@ ngx_http_v2_early_hints_filter(ngx_http_request_t *r)
header[i].value.len, tmp);
}
- frame = ngx_http_v2_create_headers_frame(r, start, pos, 0);
+ frame = ngx_http_v2_create_headers_frame(r, start, pos, 0, 1);
if (frame == NULL) {
return NGX_ERROR;
}
@@ -825,7 +826,7 @@ ngx_http_v2_init_stream(ngx_http_request_t *r)
static ngx_http_v2_out_frame_t *
ngx_http_v2_create_headers_frame(ngx_http_request_t *r, u_char *pos,
- u_char *end, ngx_uint_t fin)
+ u_char *end, ngx_uint_t fin, ngx_uint_t flush)
{
u_char type, flags;
size_t rest, frame_size;
@@ -916,6 +917,7 @@ ngx_http_v2_create_headers_frame(ngx_http_request_t *r, u_char *pos,
}
b->last_buf = fin;
+ b->flush = flush;
cl->next = NULL;
frame->last = cl;
@@ -1038,7 +1040,7 @@ ngx_http_v2_create_trailers_frame(ngx_http_request_t *r)
header[i].value.len, tmp);
}
- return ngx_http_v2_create_headers_frame(r, start, pos, 1);
+ return ngx_http_v2_create_headers_frame(r, start, pos, 1, 0);
}