diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index 256bd9b..66bd36e 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -124,6 +124,7 @@ sw_major_digit, sw_first_minor_digit, sw_minor_digit, + sw_spaces_after_digit, sw_almost_done } state; @@ -636,11 +637,30 @@ goto done; } + if (ch == ' ') { + state = sw_spaces_after_digit; + break; + } + if (ch < '0' || ch > '9') { return NGX_HTTP_PARSE_INVALID_REQUEST; } r->http_minor = r->http_minor * 10 + ch - '0'; + break; + + case sw_spaces_after_digit: + switch (ch) { + case ' ': + break; + case CR: + state = sw_almost_done; + break; + case LF: + goto done; + default: + return NGX_HTTP_PARSE_INVALID_REQUEST; + } break; /* end of request line */