projects
/
nginx.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
upstream 0.7.33
[nginx.git]
/
nginx
/
src
/
http
/
modules
/
ngx_http_index_module.c
diff --git
a/nginx/src/http/modules/ngx_http_index_module.c
b/nginx/src/http/modules/ngx_http_index_module.c
index
936ec8d
..
f9ce849
100644
(file)
--- a/
nginx/src/http/modules/ngx_http_index_module.c
+++ b/
nginx/src/http/modules/ngx_http_index_module.c
@@
-96,7
+96,7
@@
static ngx_int_t
ngx_http_index_handler(ngx_http_request_t *r)
{
u_char *p, *name;
ngx_http_index_handler(ngx_http_request_t *r)
{
u_char *p, *name;
- size_t len,
nlen, root
, allocated;
+ size_t len,
root, reserve
, allocated;
ngx_int_t rc;
ngx_str_t path, uri;
ngx_uint_t i, dir_tested;
ngx_int_t rc;
ngx_str_t path, uri;
ngx_uint_t i, dir_tested;
@@
-128,6
+128,7
@@
ngx_http_index_handler(ngx_http_request_t *r)
root = 0;
dir_tested = 0;
name = NULL;
root = 0;
dir_tested = 0;
name = NULL;
+ /* suppress MSVC warning */
path.data = NULL;
index = ilcf->indices->elts;
path.data = NULL;
index = ilcf->indices->elts;
@@
-139,8
+140,8
@@
ngx_http_index_handler(ngx_http_request_t *r)
return ngx_http_internal_redirect(r, &index[i].name, &r->args);
}
return ngx_http_internal_redirect(r, &index[i].name, &r->args);
}
-
len
= ilcf->max_index_len;
-
n
len = index[i].name.len;
+
reserve
= ilcf->max_index_len;
+ len = index[i].name.len;
} else {
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
} else {
ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
@@
-149,8
+150,7
@@
ngx_http_index_handler(ngx_http_request_t *r)
e.request = r;
e.flushed = 1;
e.request = r;
e.flushed = 1;
- /* 1 byte for terminating '\0' */
-
+ /* 1 is for terminating '\0' as in static names */
len = 1;
while (*(uintptr_t *) e.ip) {
len = 1;
while (*(uintptr_t *) e.ip) {
@@
-158,21
+158,19
@@
ngx_http_index_handler(ngx_http_request_t *r)
len += lcode(&e);
}
len += lcode(&e);
}
- nlen = len;
-
/* 16 bytes are preallocation */
/* 16 bytes are preallocation */
-
len +=
16;
+
reserve = len +
16;
}
}
- if (
len > (size_t) (path.data + allocated - name)
) {
+ if (
reserve > allocated
) {
- name = ngx_http_map_uri_to_path(r, &path, &root,
len
);
+ name = ngx_http_map_uri_to_path(r, &path, &root,
reserve
);
if (name == NULL) {
return NGX_ERROR;
}
if (name == NULL) {
return NGX_ERROR;
}
- allocated = path.
len
;
+ allocated = path.
data + path.len - name
;
}
if (index[i].values == NULL) {
}
if (index[i].values == NULL) {
@@
-193,7
+191,7
@@
ngx_http_index_handler(ngx_http_request_t *r)
}
if (*name == '/') {
}
if (*name == '/') {
- uri.len =
n
len - 1;
+ uri.len = len - 1;
uri.data = name;
return ngx_http_internal_redirect(r, &uri, &r->args);
}
uri.data = name;
return ngx_http_internal_redirect(r, &uri, &r->args);
}
@@
-248,7
+246,7
@@
ngx_http_index_handler(ngx_http_request_t *r)
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- uri.len = r->uri.len +
n
len - 1;
+ uri.len = r->uri.len + len - 1;
if (!clcf->alias) {
uri.data = path.data + root;
if (!clcf->alias) {
uri.data = path.data + root;
@@
-260,7
+258,7
@@
ngx_http_index_handler(ngx_http_request_t *r)
}
p = ngx_copy(uri.data, r->uri.data, r->uri.len);
}
p = ngx_copy(uri.data, r->uri.data, r->uri.len);
- ngx_memcpy(p, name,
n
len - 1);
+ ngx_memcpy(p, name, len - 1);
}
return ngx_http_internal_redirect(r, &uri, &r->args);
}
return ngx_http_internal_redirect(r, &uri, &r->args);
@@
-491,7
+489,7
@@
ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
continue;
}
continue;
}
- /* include the terminating '\0' to the length to use ngx_
co
py() */
+ /* include the terminating '\0' to the length to use ngx_
memc
py() */
index->name.len++;
continue;
index->name.len++;
continue;