aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2020-04-21 17:11:49 +0300
committerRoman Arutyunyan <arut@nginx.com>2020-04-21 17:11:49 +0300
commit400eb1b628ce60625df5f6844899ca4cd6d8cbed (patch)
tree36bee8281811cfb7082807ed12523caec15831bb /src
parentf5036584840df54c066af8452fcc75b6af7ded97 (diff)
downloadnginx-400eb1b628ce60625df5f6844899ca4cd6d8cbed.tar.gz
nginx-400eb1b628ce60625df5f6844899ca4cd6d8cbed.zip
HTTP/3: fixed encoding variable-length integers.
Diffstat (limited to 'src')
-rw-r--r--src/http/v3/ngx_http_v3.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/http/v3/ngx_http_v3.c b/src/http/v3/ngx_http_v3.c
index cca84dbc1..f7f79b9f4 100644
--- a/src/http/v3/ngx_http_v3.c
+++ b/src/http/v3/ngx_http_v3.c
@@ -34,21 +34,25 @@ ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value)
if (value <= 1073741823) {
if (p == NULL) {
- return 3;
+ return 4;
}
- *p++ = 0x80 | (value >> 16);
+ *p++ = 0x80 | (value >> 24);
+ *p++ = (value >> 16);
*p++ = (value >> 8);
*p++ = value;
return (uintptr_t) p;
-
}
if (p == NULL) {
- return 4;
+ return 8;
}
- *p++ = 0xc0 | (value >> 24);
+ *p++ = 0xc0 | (value >> 56);
+ *p++ = (value >> 48);
+ *p++ = (value >> 40);
+ *p++ = (value >> 32);
+ *p++ = (value >> 24);
*p++ = (value >> 16);
*p++ = (value >> 8);
*p++ = value;