Latest update - GitHub fd0848b (1.29.3)
This commit is contained in:
@@ -111,6 +111,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
sw_schema,
|
||||
sw_schema_slash,
|
||||
sw_schema_slash_slash,
|
||||
sw_spaces_before_host,
|
||||
sw_host_start,
|
||||
sw_host,
|
||||
sw_host_end,
|
||||
@@ -158,6 +159,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
if (ch == ' ') {
|
||||
r->method_end = p - 1;
|
||||
m = r->request_start;
|
||||
state = sw_spaces_before_uri;
|
||||
|
||||
switch (p - m) {
|
||||
|
||||
@@ -247,6 +249,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
if (ngx_str7_cmp(m, 'C', 'O', 'N', 'N', 'E', 'C', 'T', ' '))
|
||||
{
|
||||
r->method = NGX_HTTP_CONNECT;
|
||||
state = sw_spaces_before_host;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -269,7 +272,6 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
break;
|
||||
}
|
||||
|
||||
state = sw_spaces_before_uri;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -345,6 +347,14 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
}
|
||||
break;
|
||||
|
||||
case sw_spaces_before_host:
|
||||
|
||||
if (ch == ' ') {
|
||||
break;
|
||||
}
|
||||
|
||||
/* fall through */
|
||||
|
||||
case sw_host_start:
|
||||
|
||||
r->host_start = p;
|
||||
@@ -375,6 +385,15 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
|
||||
r->host_end = p;
|
||||
|
||||
if (r->method == NGX_HTTP_CONNECT) {
|
||||
if (ch == ':') {
|
||||
state = sw_port;
|
||||
break;
|
||||
}
|
||||
|
||||
return NGX_HTTP_PARSE_INVALID_REQUEST;
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
case ':':
|
||||
state = sw_port;
|
||||
@@ -446,9 +465,23 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
|
||||
case sw_port:
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
if (r->port >= 6553 && (r->port > 6553 || (ch - '0') > 5)) {
|
||||
return NGX_HTTP_PARSE_INVALID_REQUEST;
|
||||
}
|
||||
|
||||
r->port = r->port * 10 + (ch - '0');
|
||||
break;
|
||||
}
|
||||
|
||||
if (r->method == NGX_HTTP_CONNECT) {
|
||||
if (ch == ' ') {
|
||||
state = sw_http_09;
|
||||
break;
|
||||
}
|
||||
|
||||
return NGX_HTTP_PARSE_INVALID_REQUEST;
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
case '/':
|
||||
r->uri_start = p;
|
||||
@@ -684,6 +717,16 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
|
||||
case sw_http_HTTP:
|
||||
switch (ch) {
|
||||
case '/':
|
||||
|
||||
/*
|
||||
* use single "/" from request line to preserve pointers,
|
||||
* if request line will be copied to large client buffer
|
||||
*/
|
||||
if (r->method == NGX_HTTP_CONNECT) {
|
||||
r->uri_start = p;
|
||||
r->uri_end = p + 1;
|
||||
}
|
||||
|
||||
state = sw_first_major_digit;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user