diff src/http/ngx_http_parse.c @ 6993:8801ff7d58e1

Don't pretend we support HTTP major versions >1 as HTTP/1.1.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 25 Apr 2017 23:39:13 +0300
parents 57148b755320
children f38647c651a8
line wrap: on
line diff
--- a/src/http/ngx_http_parse.c	Tue Apr 25 23:39:06 2017 +0300
+++ b/src/http/ngx_http_parse.c	Tue Apr 25 23:39:13 2017 +0300
@@ -723,6 +723,11 @@
             }
 
             r->http_major = ch - '0';
+
+            if (r->http_major > 1) {
+                return NGX_HTTP_PARSE_INVALID_VERSION;
+            }
+
             state = sw_major_digit;
             break;
 
@@ -737,11 +742,12 @@
                 return NGX_HTTP_PARSE_INVALID_REQUEST;
             }
 
-            if (r->http_major > 99) {
-                return NGX_HTTP_PARSE_INVALID_REQUEST;
+            r->http_major = r->http_major * 10 + ch - '0';
+
+            if (r->http_major > 1) {
+                return NGX_HTTP_PARSE_INVALID_VERSION;
             }
 
-            r->http_major = r->http_major * 10 + ch - '0';
             break;
 
         /* first digit of minor HTTP version */