mirror of
https://github.com/nginx/nginx.git
synced 2024-12-23 15:40:03 -06:00
HTTP/2: improved the ngx_http_v2_integer_octets(v) macro.
Previously, it didn't work well for 0, 127, and 128, returning less than needed.
This commit is contained in:
parent
3565680d94
commit
d418b92cdc
@ -12,7 +12,12 @@
|
|||||||
#include <ngx_http_v2_module.h>
|
#include <ngx_http_v2_module.h>
|
||||||
|
|
||||||
|
|
||||||
#define ngx_http_v2_integer_octets(v) (((v) + 127) / 128)
|
/*
|
||||||
|
* This returns precise number of octets for values in range 0..253
|
||||||
|
* and estimate number for the rest, but not smaller than required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ngx_http_v2_integer_octets(v) (1 + (v) / 127)
|
||||||
|
|
||||||
#define ngx_http_v2_literal_size(h) \
|
#define ngx_http_v2_literal_size(h) \
|
||||||
(ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
|
(ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user