diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-10-12 13:36:54 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-10-12 13:36:54 +0000 |
commit | 0e5f86d871713b35e6e402ceee3435675c2c5b7f (patch) | |
tree | 34a3bed03cd7c378626606add0b6de870b98d6e2 | |
parent | c3df798bb434682be2ea3b4d09e923bc58f0af34 (diff) | |
download | nginx-0e5f86d871713b35e6e402ceee3435675c2c5b7f.tar.gz nginx-0e5f86d871713b35e6e402ceee3435675c2c5b7f.zip |
remove r->root_length
-rw-r--r-- | src/http/modules/ngx_http_autoindex_module.c | 5 | ||||
-rw-r--r-- | src/http/modules/ngx_http_dav_module.c | 8 | ||||
-rw-r--r-- | src/http/modules/ngx_http_index_module.c | 6 | ||||
-rw-r--r-- | src/http/modules/ngx_http_static_module.c | 3 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.c | 11 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.h | 2 | ||||
-rw-r--r-- | src/http/ngx_http_request.h | 2 | ||||
-rw-r--r-- | src/http/ngx_http_variables.c | 3 |
8 files changed, 23 insertions, 17 deletions
diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c index 1c7709376..f5944c447 100644 --- a/src/http/modules/ngx_http_autoindex_module.c +++ b/src/http/modules/ngx_http_autoindex_module.c @@ -135,7 +135,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) { u_char *last, *filename, scale; off_t length; - size_t len, copy, allocated; + size_t len, copy, allocated, root; ngx_tm_t tm; ngx_err_t err; ngx_buf_t *b; @@ -174,7 +174,8 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) /* NGX_DIR_MASK_LEN is lesser than NGX_HTTP_AUTOINDEX_PREALLOCATE */ - last = ngx_http_map_uri_to_path(r, &path, NGX_HTTP_AUTOINDEX_PREALLOCATE); + last = ngx_http_map_uri_to_path(r, &path, &root, + NGX_HTTP_AUTOINDEX_PREALLOCATE); if (last == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c index 02dd3886e..81c1dc49a 100644 --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -102,6 +102,7 @@ static ngx_int_t ngx_http_dav_handler(ngx_http_request_t *r) { char *failed; + size_t root; ngx_int_t rc; ngx_str_t path; ngx_file_info_t fi; @@ -152,7 +153,7 @@ ngx_http_dav_handler(ngx_http_request_t *r) return rc; } - ngx_http_map_uri_to_path(r, &path, 0); + ngx_http_map_uri_to_path(r, &path, &root, 0); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http delete filename: \"%s\"", path.data); @@ -219,7 +220,7 @@ ngx_http_dav_handler(ngx_http_request_t *r) return rc; } - ngx_http_map_uri_to_path(r, &path, 0); + ngx_http_map_uri_to_path(r, &path, &root, 0); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http mkcol path: \"%s\"", path.data); @@ -245,6 +246,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r) { char *failed; u_char *name; + size_t root; time_t date; ngx_err_t err; ngx_str_t *temp, path; @@ -252,7 +254,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r) ngx_file_info_t fi; ngx_http_dav_loc_conf_t *dlcf; - ngx_http_map_uri_to_path(r, &path, 0); + ngx_http_map_uri_to_path(r, &path, &root, 0); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http put filename: \"%s\"", path.data); diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c index cd1c51ee5..3af802663 100644 --- a/src/http/modules/ngx_http_index_module.c +++ b/src/http/modules/ngx_http_index_module.c @@ -28,6 +28,8 @@ typedef struct { ngx_str_t path; ngx_str_t index; + size_t root; + ngx_uint_t tested; /* unsigned tested:1 */ } ngx_http_index_ctx_t; @@ -200,7 +202,7 @@ ngx_http_index_handler(ngx_http_request_t *r) if (len > (size_t) (ctx->path.data + ctx->path.len - ctx->index.data)) { - last = ngx_http_map_uri_to_path(r, &ctx->path, len); + last = ngx_http_map_uri_to_path(r, &ctx->path, &ctx->root, len); if (last == NULL) { return NGX_ERROR; } @@ -291,7 +293,7 @@ ngx_http_index_handler(ngx_http_request_t *r) uri.len = r->uri.len + ctx->index.len - 1; if (!clcf->alias) { - uri.data = ctx->path.data + r->root_length; + uri.data = ctx->path.data + ctx->root; } else { uri.data = ngx_palloc(r->pool, uri.len); diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c index f9df46eeb..bc150bffa 100644 --- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c @@ -73,6 +73,7 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r) { u_char *last, *location; + size_t root; ngx_fd_t fd; ngx_int_t rc; ngx_uint_t level; @@ -112,7 +113,7 @@ ngx_http_static_handler(ngx_http_request_t *r) * so we do not need to reserve memory for '/' for possible redirect */ - last = ngx_http_map_uri_to_path(r, &path, 0); + last = ngx_http_map_uri_to_path(r, &path, &root, 0); if (last == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 0cc9c7ffa..9dc2069e2 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -794,6 +794,7 @@ ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph) { + size_t root; ngx_int_t rc; ngx_str_t path; @@ -830,7 +831,7 @@ ngx_http_core_content_phase(ngx_http_request_t *r, if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) { - if (ngx_http_map_uri_to_path(r, &path, 0) != NULL) { + if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "directory index of \"%V\" is forbidden", &path); } @@ -1157,7 +1158,7 @@ ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *in) u_char * ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, - size_t reserved) + size_t *root_length, size_t reserved) { u_char *last; size_t alias; @@ -1178,7 +1179,7 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, if (clcf->root_lengths == NULL) { - r->root_length = clcf->root.len; + *root_length = clcf->root.len; path->len = clcf->root.len + reserved; @@ -1201,8 +1202,8 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, return NULL; } - r->root_length = path->len - reserved; - last = path->data + r->root_length; + *root_length = path->len - reserved; + last = path->data + *root_length; } last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index f8ea3281a..c468fa3ef 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -301,7 +301,7 @@ ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r, 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); u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name, - size_t reserved); + size_t *root_length, size_t reserved); ngx_int_t ngx_http_auth_basic_user(ngx_http_request_t *r); ngx_int_t ngx_http_subrequest(ngx_http_request_t *r, diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index 204d62f09..6c0796b5b 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -357,8 +357,6 @@ struct ngx_http_request_s { ngx_http_variable_value_t *variables; - size_t root_length; - size_t limit_rate; /* used to learn the Apache compatible response length without a header */ diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index 0f1587b64..ecf20c372 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -852,9 +852,10 @@ static ngx_int_t ngx_http_variable_request_filename(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { + size_t root; ngx_str_t path; - if (ngx_http_map_uri_to_path(r, &path, 0) == NULL) { + if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) { return NGX_ERROR; } |