]> git.kaiwu.me - nginx.git/commitdiff
remove r->zero_in_uri
authorIgor Sysoev <igor@sysoev.ru>
Mon, 24 May 2010 12:35:10 +0000 (12:35 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 24 May 2010 12:35:10 +0000 (12:35 +0000)
13 files changed:
src/http/modules/ngx_http_autoindex_module.c
src/http/modules/ngx_http_dav_module.c
src/http/modules/ngx_http_flv_module.c
src/http/modules/ngx_http_gzip_static_module.c
src/http/modules/ngx_http_index_module.c
src/http/modules/ngx_http_random_index_module.c
src/http/modules/ngx_http_static_module.c
src/http/modules/perl/ngx_http_perl_module.c
src/http/ngx_http_core_module.c
src/http/ngx_http_parse.c
src/http/ngx_http_request.h
src/http/ngx_http_special_response.c
src/http/ngx_http_upstream.c

index 9dc48702fdf65ab013d45c04368d19be93293b43..b6793180698055182a581a7c20dfdc3d373594e1 100644 (file)
@@ -160,10 +160,6 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
         return NGX_DECLINED;
     }
index 4b561105cd772706e23b5f9a8f3949b86a72107a..3d34a4009844f26f3d1c8203134046425fe88d75 100644 (file)
@@ -146,10 +146,6 @@ ngx_http_dav_handler(ngx_http_request_t *r)
     ngx_int_t                 rc;
     ngx_http_dav_loc_conf_t  *dlcf;
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
 
     if (!(r->method & dlcf->methods)) {
index 995ac830e9090151735faebf5ef51b4368299b43..270d969db305551f2c28567b8dbba317a0ba75d3 100644 (file)
@@ -80,10 +80,6 @@ ngx_http_flv_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     rc = ngx_http_discard_request_body(r);
 
     if (rc != NGX_OK) {
index 0c6dbbb4ad59cbce871f955ca25067745f71eaee..9e3b1ad6695efcfc396d6123508d4eccddbb4542 100644 (file)
@@ -89,10 +89,6 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
 
     if (!gzcf->enable) {
index fe2a121b66365ab8766e435f06da0f5c1be9ac99..15aeaf9c60ef6413f692aa055d2099f334912d70 100644 (file)
@@ -116,10 +116,6 @@ ngx_http_index_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     ilcf = ngx_http_get_module_loc_conf(r, ngx_http_index_module);
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
index 7b0ec503ce45804244b296e071dc539d69c22d49..02bdc45f9ea95f4d8d4b8ba3d21ffcd9a109224e 100644 (file)
@@ -86,10 +86,6 @@ ngx_http_random_index_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {
         return NGX_DECLINED;
     }
index 3af97bacd99ecd48141092a72f87e6724cf539ae..57b5130d4f9351a61ee189c854c275d85debb21a 100644 (file)
@@ -66,10 +66,6 @@ ngx_http_static_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->zero_in_uri) {
-        return NGX_DECLINED;
-    }
-
     log = r->connection->log;
 
     /*
index 5096b506d63da46b5a05dfc2d3217f5167e3cdf5..d89e96a57226313aa068094d13f9c099970af9d3 100644 (file)
@@ -168,10 +168,6 @@ ngx_http_perl_xs_init(pTHX)
 static ngx_int_t
 ngx_http_perl_handler(ngx_http_request_t *r)
 {
-    if (r->zero_in_uri) {
-        return NGX_HTTP_NOT_FOUND;
-    }
-
     r->main->count++;
 
     ngx_http_perl_handle_request(r);
index 23e938897f8a74ade672f3172feca0c505375add..21ea7e9d2aacc53425c0c206cbc9b8fd85a85aba 100644 (file)
@@ -1341,7 +1341,7 @@ ngx_http_core_content_phase(ngx_http_request_t *r,
 
     /* no content handler was found */
 
-    if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) {
+    if (r->uri.data[r->uri.len - 1] == '/') {
 
         if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) {
             ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
@@ -2104,7 +2104,6 @@ ngx_http_subrequest(ngx_http_request_t *r,
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
                    "http subrequest \"%V?%V\"", uri, &sr->args);
 
-    sr->zero_in_uri = (flags & NGX_HTTP_ZERO_IN_URI) != 0;
     sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0;
     sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0;
 
index b638f86fcd66d00bc9bca46203a20f19cee9b014..2952e02eaba7caaef236a7dab8fef17d1ba28128 100644 (file)
@@ -438,8 +438,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
                 r->plus_in_uri = 1;
                 break;
             case '\0':
-                r->zero_in_uri = 1;
-                break;
+                return NGX_HTTP_PARSE_INVALID_REQUEST;
             default:
                 state = sw_check_uri;
                 break;
@@ -496,8 +495,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
                 r->plus_in_uri = 1;
                 break;
             case '\0':
-                r->zero_in_uri = 1;
-                break;
+                return NGX_HTTP_PARSE_INVALID_REQUEST;
             }
             break;
 
@@ -526,8 +524,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
                 r->complex_uri = 1;
                 break;
             case '\0':
-                r->zero_in_uri = 1;
-                break;
+                return NGX_HTTP_PARSE_INVALID_REQUEST;
             }
             break;
 
@@ -1202,7 +1199,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
                     ch = *p++;
 
                 } else if (ch == '\0') {
-                    r->zero_in_uri = 1;
+                    return NGX_HTTP_PARSE_INVALID_REQUEST;
                 }
 
                 state = quoted_state;
@@ -1304,8 +1301,7 @@ ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
         }
 
         if (ch == '\0') {
-            *flags |= NGX_HTTP_ZERO_IN_URI;
-            continue;
+            goto unsafe;
         }
 
         if (ngx_path_separator(ch) && len > 2) {
@@ -1449,34 +1445,19 @@ ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
 void
 ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
 {
-    u_char  ch, *p, *last;
-
-    p = uri->data;
-
-    last = p + uri->len;
-
-    args->len = 0;
-
-    while (p < last) {
-
-        ch = *p++;
+    u_char  *p, *last;
 
-        if (ch == '?') {
-            args->len = last - p;
-            args->data = p;
+    last = uri->data + uri->len;
 
-            uri->len = p - 1 - uri->data;
+    p = ngx_strlchr(uri->data, last, '?');
 
-            if (ngx_strlchr(p, last, '\0') != NULL) {
-                r->zero_in_uri = 1;
-            }
+    if (p) {
+        uri->len = p - uri->data;
+        p++;
+        args->len = last - p;
+        args->data = p;
 
-            return;
-        }
-
-        if (ch == '\0') {
-            r->zero_in_uri = 1;
-            continue;
-        }
+    } else {
+        args->len = 0;
     }
 }
index 902ec3ec1497c583f519c5f482ea258e8e726a68..f9622714c5b86432d74ce39be70eff6229c46a00 100644 (file)
@@ -56,7 +56,7 @@
 #define NGX_HTTP_PARSE_INVALID_HEADER      13
 
 
-#define NGX_HTTP_ZERO_IN_URI               1
+/* unused                                  1 */
 #define NGX_HTTP_SUBREQUEST_IN_MEMORY      2
 #define NGX_HTTP_SUBREQUEST_WAITED         4
 #define NGX_HTTP_LOG_UNSAFE                8
@@ -435,9 +435,6 @@ struct ngx_http_request_s {
     /* URI with "+" */
     unsigned                          plus_in_uri:1;
 
-    /* URI with "\0" or "%00" */
-    unsigned                          zero_in_uri:1;
-
     unsigned                          invalid_header:1;
 
     unsigned                          valid_location:1;
index 5c032f3a5449cfa344fa26ac313d33d6edb3781f..afbefba2d77967fa0e4d13ee181c6b70a93652f4 100644 (file)
@@ -517,8 +517,6 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page)
 
     r->err_status = overwrite;
 
-    r->zero_in_uri = 0;
-
     if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
         return NGX_ERROR;
     }
index 4226198ba84b5a724dca59cb664da2b58a674a92..ffed2c00c713d4a5376b1023459df520d5d47256 100644 (file)
@@ -1815,10 +1815,6 @@ ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u)
             return NGX_DONE;
         }
 
-        if (flags & NGX_HTTP_ZERO_IN_URI) {
-            r->zero_in_uri = 1;
-        }
-
         if (r->method != NGX_HTTP_HEAD) {
             r->method = NGX_HTTP_GET;
         }