r1585 merge:

allow full URL without URI part: "GET http://host HTTP/1.0"
This commit is contained in:
Igor Sysoev 2007-12-12 20:42:47 +00:00
parent 3ca0a3fd07
commit 5f9301abf7

View File

@ -335,18 +335,26 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
break; break;
} }
r->host_end = p;
switch (ch) { switch (ch) {
case ':': case ':':
r->host_end = p;
state = sw_port; state = sw_port;
break; break;
case '/': case '/':
r->host_end = p;
r->uri_start = p; r->uri_start = p;
state = sw_after_slash_in_uri; state = sw_after_slash_in_uri;
break; break;
case ' ':
/*
* use single "/" from request line to preserve pointers,
* if request line will be copied to large client buffer
*/
r->uri_start = r->schema_end + 1;
r->uri_end = r->schema_end + 2;
state = sw_http_09;
break;
default: default:
r->host_end = p;
return NGX_HTTP_PARSE_INVALID_REQUEST; return NGX_HTTP_PARSE_INVALID_REQUEST;
} }
break; break;
@ -362,6 +370,16 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
r->uri_start = p; r->uri_start = p;
state = sw_after_slash_in_uri; state = sw_after_slash_in_uri;
break; break;
case ' ':
r->port_end = p;
/*
* use single "/" from request line to preserve pointers,
* if request line will be copied to large client buffer
*/
r->uri_start = r->schema_end + 1;
r->uri_end = r->schema_end + 2;
state = sw_http_09;
break;
default: default:
return NGX_HTTP_PARSE_INVALID_REQUEST; return NGX_HTTP_PARSE_INVALID_REQUEST;
} }