comparison 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
comparison
equal deleted inserted replaced
6992:330b6c33a5c4 6993:8801ff7d58e1
721 if (ch < '1' || ch > '9') { 721 if (ch < '1' || ch > '9') {
722 return NGX_HTTP_PARSE_INVALID_REQUEST; 722 return NGX_HTTP_PARSE_INVALID_REQUEST;
723 } 723 }
724 724
725 r->http_major = ch - '0'; 725 r->http_major = ch - '0';
726
727 if (r->http_major > 1) {
728 return NGX_HTTP_PARSE_INVALID_VERSION;
729 }
730
726 state = sw_major_digit; 731 state = sw_major_digit;
727 break; 732 break;
728 733
729 /* major HTTP version or dot */ 734 /* major HTTP version or dot */
730 case sw_major_digit: 735 case sw_major_digit:
735 740
736 if (ch < '0' || ch > '9') { 741 if (ch < '0' || ch > '9') {
737 return NGX_HTTP_PARSE_INVALID_REQUEST; 742 return NGX_HTTP_PARSE_INVALID_REQUEST;
738 } 743 }
739 744
740 if (r->http_major > 99) {
741 return NGX_HTTP_PARSE_INVALID_REQUEST;
742 }
743
744 r->http_major = r->http_major * 10 + ch - '0'; 745 r->http_major = r->http_major * 10 + ch - '0';
746
747 if (r->http_major > 1) {
748 return NGX_HTTP_PARSE_INVALID_VERSION;
749 }
750
745 break; 751 break;
746 752
747 /* first digit of minor HTTP version */ 753 /* first digit of minor HTTP version */
748 case sw_first_minor_digit: 754 case sw_first_minor_digit:
749 if (ch < '0' || ch > '9') { 755 if (ch < '0' || ch > '9') {