# HG changeset patch # User Valentin Bartenev # Date 1445870776 -10800 # Node ID c72eaf694d99ba1e17f2f93fb6c0e06b3ace28ac # Parent b78df0822168327802873c7e4befeefbdfb89712 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. diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -12,7 +12,12 @@ #include -#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) \ (ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)