]> git.kaiwu.me - nginx.git/commitdiff
HTTP/3: fixed encoding variable-length integers.
authorRoman Arutyunyan <arut@nginx.com>
Tue, 21 Apr 2020 14:11:49 +0000 (17:11 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Tue, 21 Apr 2020 14:11:49 +0000 (17:11 +0300)
src/http/v3/ngx_http_v3.c

index cca84dbc1f8ce87b403e5ffc84704ea9561c92f7..f7f79b9f4acd2103c9d6ad64f98ccd5c799fd4b8 100644 (file)
@@ -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;