mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
HTTP/3: fixed encoding variable-length integers.
This commit is contained in:
parent
f503658484
commit
400eb1b628
@ -34,21 +34,25 @@ ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value)
|
|||||||
|
|
||||||
if (value <= 1073741823) {
|
if (value <= 1073741823) {
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = 0x80 | (value >> 16);
|
*p++ = 0x80 | (value >> 24);
|
||||||
|
*p++ = (value >> 16);
|
||||||
*p++ = (value >> 8);
|
*p++ = (value >> 8);
|
||||||
*p++ = value;
|
*p++ = value;
|
||||||
return (uintptr_t) p;
|
return (uintptr_t) p;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == NULL) {
|
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 >> 16);
|
||||||
*p++ = (value >> 8);
|
*p++ = (value >> 8);
|
||||||
*p++ = value;
|
*p++ = value;
|
||||||
|
Loading…
Reference in New Issue
Block a user