Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: improved the ngx_http_v2_integer_octets(v) macro.

Valentin Bartenev
October 26, 2015 10:48AM
details: http://hg.nginx.org/nginx/rev/c72eaf694d99
branches:
changeset: 6279:c72eaf694d99
user: Valentin Bartenev <vbart@nginx.com>
date: Mon Oct 26 17:46:16 2015 +0300
description:
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.

diffstat:

src/http/v2/ngx_http_v2_filter_module.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r b78df0822168 -r c72eaf694d99 src/http/v2/ngx_http_v2_filter_module.c
--- a/src/http/v2/ngx_http_v2_filter_module.c Mon Oct 26 17:46:13 2015 +0300
+++ b/src/http/v2/ngx_http_v2_filter_module.c Mon Oct 26 17:46:16 2015 +0300
@@ -12,7 +12,12 @@
#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) \
(ngx_http_v2_integer_octets(sizeof(h) - 1) + sizeof(h) - 1)

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: improved the ngx_http_v2_integer_octets(v) macro.

Valentin Bartenev 340 October 26, 2015 10:48AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 209
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready