From b48093291a7bd1c0307002225e0c7fbadf79960e Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 14 Jul 2009 08:38:28 +0000 Subject: [PATCH] ngx_http_set_exten() is always successful since 0.3.46 --- src/http/ngx_http_core_module.c | 22 +++++++--------------- src/http/ngx_http_core_module.h | 2 +- src/http/ngx_http_script.c | 6 +----- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 3d2ccd083..9d614d450 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1228,10 +1228,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, ngx_memcpy(p, name, path.len); } - if (ngx_http_set_exten(r) != NGX_OK) { - ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); - return NGX_OK; - } + ngx_http_set_exten(r); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "try file uri: \"%V\"", &r->uri); @@ -1641,7 +1638,7 @@ ngx_http_set_content_type(ngx_http_request_t *r) } -ngx_int_t +void ngx_http_set_exten(ngx_http_request_t *r) { ngx_int_t i; @@ -1655,14 +1652,14 @@ ngx_http_set_exten(ngx_http_request_t *r) r->exten.len = r->uri.len - i - 1; r->exten.data = &r->uri.data[i + 1]; - break; + return; } else if (r->uri.data[i] == '/') { - break; + return; } } - return NGX_OK; + return; } @@ -2087,9 +2084,7 @@ ngx_http_subrequest(ngx_http_request_t *r, sr->method_name = ngx_http_core_get_method; sr->http_protocol = r->http_protocol; - if (ngx_http_set_exten(sr) != NGX_OK) { - return NGX_ERROR; - } + ngx_http_set_exten(sr); sr->main = r->main; sr->parent = r; @@ -2168,10 +2163,7 @@ ngx_http_internal_redirect(ngx_http_request_t *r, ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "internal redirect: \"%V?%V\"", uri, &r->args); - if (ngx_http_set_exten(r) != NGX_OK) { - ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); - return NGX_DONE; - } + ngx_http_set_exten(r); /* clear the modules contexts */ ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index e7bffbfa7..71d5b953c 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -438,7 +438,7 @@ ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r, void *ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash); ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r); -ngx_int_t ngx_http_set_exten(ngx_http_request_t *r); +void ngx_http_set_exten(ngx_http_request_t *r); u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name, size_t *root_length, size_t reserved); ngx_int_t ngx_http_auth_basic_user(ngx_http_request_t *r); diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c index dbe6c34bd..ad9d88b40 100644 --- a/src/http/ngx_http_script.c +++ b/src/http/ngx_http_script.c @@ -1074,11 +1074,7 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e) return; } - if (ngx_http_set_exten(r) != NGX_OK) { - e->ip = ngx_http_script_exit; - e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; - return; - } + ngx_http_set_exten(r); } e->ip += sizeof(ngx_http_script_regex_end_code_t);