]> git.kaiwu.me - nginx.git/commitdiff
r1585 merge:
authorIgor Sysoev <igor@sysoev.ru>
Wed, 12 Dec 2007 20:42:47 +0000 (20:42 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 12 Dec 2007 20:42:47 +0000 (20:42 +0000)
allow full URL without URI part: "GET http://host HTTP/1.0"

src/http/ngx_http_parse.c

index 559a5cbd54ed981e3c1656a3b1500a35b967e8a4..40e7700d371feb2437e6f22de3c9f2378c4db3c5 100644 (file)
@@ -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;
             }