diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-12-12 20:42:47 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-12-12 20:42:47 +0000 |
| commit | 5f9301abf71a3bb48a8864daa78a9dcfe8a6a27e (patch) | |
| tree | 3c266a34b935011d1adbb643993e18a6f979973d /src | |
| parent | 3ca0a3fd07c024c77066ee70b3cda9d2b11c30fd (diff) | |
| download | nginx-5f9301abf71a3bb48a8864daa78a9dcfe8a6a27e.tar.gz nginx-5f9301abf71a3bb48a8864daa78a9dcfe8a6a27e.tar.bz2 | |
r1585 merge:
allow full URL without URI part: "GET http://host HTTP/1.0"
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/ngx_http_parse.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index 559a5cbd5..40e7700d3 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -335,18 +335,26 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b) break; } + r->host_end = p; + switch (ch) { case ':': - r->host_end = p; state = sw_port; break; case '/': - r->host_end = p; r->uri_start = p; state = sw_after_slash_in_uri; 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: - r->host_end = p; return NGX_HTTP_PARSE_INVALID_REQUEST; } break; @@ -362,6 +370,16 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b) r->uri_start = p; state = sw_after_slash_in_uri; 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: return NGX_HTTP_PARSE_INVALID_REQUEST; } |
