[nginx] HTTP/2: improved HPACK integer parsing code readability.

Valentin Bartenev vbart at nginx.com
Tue Oct 20 18:33:01 UTC 2015


details:   http://hg.nginx.org/nginx/rev/adaac65899c8
branches:  
changeset: 6267:adaac65899c8
user:      Ruslan Ermilov <ru at nginx.com>
date:      Tue Oct 20 21:26:38 2015 +0300
description:
HTTP/2: improved HPACK integer parsing code readability.

No functional changes.

diffstat:

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

diffs (23 lines):

diff -r dceb078b1156 -r adaac65899c8 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c	Tue Oct 20 18:16:18 2015 +0300
+++ b/src/http/v2/ngx_http_v2.c	Tue Oct 20 21:26:38 2015 +0300
@@ -2396,8 +2396,8 @@ ngx_http_v2_parse_int(ngx_http_v2_connec
         return value;
     }
 
-    if (end - p > NGX_HTTP_V2_INT_OCTETS - 1) {
-        end = p + NGX_HTTP_V2_INT_OCTETS - 1;
+    if (end - start > NGX_HTTP_V2_INT_OCTETS) {
+        end = start + NGX_HTTP_V2_INT_OCTETS;
     }
 
     for (shift = 0; p != end; shift += 7) {
@@ -2417,7 +2417,7 @@ ngx_http_v2_parse_int(ngx_http_v2_connec
         }
     }
 
-    if ((size_t) (end - start) >= NGX_HTTP_V2_INT_OCTETS) {
+    if (end == start + NGX_HTTP_V2_INT_OCTETS) {
         return NGX_DECLINED;
     }
 



More information about the nginx-devel mailing list