aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2020-07-13 12:33:00 +0300
committerRoman Arutyunyan <arut@nginx.com>2020-07-13 12:33:00 +0300
commit6d7ddb54711c00e6a43ae16c9151ad9d9c89a86c (patch)
tree087295aa32636c83b10ba1b85816033cceb6edf4 /src
parentfc5a7234b469cf939c7e44b76ca1146ac7ecf519 (diff)
downloadnginx-6d7ddb54711c00e6a43ae16c9151ad9d9c89a86c.tar.gz
nginx-6d7ddb54711c00e6a43ae16c9151ad9d9c89a86c.zip
HTTP/3: encode frame ids with ngx_http_v3_encode_varlen_int().
Even though typically frame ids fit into a single byte, calling ngx_http_v3_encode_varlen_int() adds to the code clarity.
Diffstat (limited to 'src')
-rw-r--r--src/http/v3/ngx_http_v3_request.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c
index 0edd8f514..af9cbd2b3 100644
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -774,14 +774,16 @@ ngx_http_v3_create_header(ngx_http_request_t *r)
n = b->last - b->pos;
- len = 1 + ngx_http_v3_encode_varlen_int(NULL, n);
+ len = ngx_http_v3_encode_varlen_int(NULL, NGX_HTTP_V3_FRAME_HEADERS)
+ + ngx_http_v3_encode_varlen_int(NULL, n);
b = ngx_create_temp_buf(c->pool, len);
if (b == NULL) {
return NULL;
}
- *b->last++ = NGX_HTTP_V3_FRAME_HEADERS;
+ b->last = (u_char *) ngx_http_v3_encode_varlen_int(b->last,
+ NGX_HTTP_V3_FRAME_HEADERS);
b->last = (u_char *) ngx_http_v3_encode_varlen_int(b->last, n);
hl = ngx_alloc_chain_link(c->pool);
@@ -793,7 +795,8 @@ ngx_http_v3_create_header(ngx_http_request_t *r)
hl->next = cl;
if (r->headers_out.content_length_n >= 0 && !r->header_only) {
- len = 1 + ngx_http_v3_encode_varlen_int(NULL,
+ len = ngx_http_v3_encode_varlen_int(NULL, NGX_HTTP_V3_FRAME_DATA)
+ + ngx_http_v3_encode_varlen_int(NULL,
r->headers_out.content_length_n);
b = ngx_create_temp_buf(c->pool, len);
@@ -801,7 +804,8 @@ ngx_http_v3_create_header(ngx_http_request_t *r)
return NULL;
}
- *b->last++ = NGX_HTTP_V3_FRAME_DATA;
+ b->last = (u_char *) ngx_http_v3_encode_varlen_int(b->last,
+ NGX_HTTP_V3_FRAME_DATA);
b->last = (u_char *) ngx_http_v3_encode_varlen_int(b->last,
r->headers_out.content_length_n);