diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-07-26 16:21:18 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-07-26 16:21:18 +0000 |
commit | ea52123c06a5c32a500e8ccb5ce9ae23db1d3a2b (patch) | |
tree | 9d21d6f4b6c657bab6eaa8f576c18c9f5beef147 /src/http/modules/ngx_http_static_handler.c | |
parent | 0599b11937990b169c05f95eeaed7cf22d823740 (diff) | |
download | nginx-ea52123c06a5c32a500e8ccb5ce9ae23db1d3a2b.tar.gz nginx-ea52123c06a5c32a500e8ccb5ce9ae23db1d3a2b.zip |
nginx-0.0.8-2004-07-26-20:21:18 import
Diffstat (limited to 'src/http/modules/ngx_http_static_handler.c')
-rw-r--r-- | src/http/modules/ngx_http_static_handler.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c index bc32cc539..9a1a814ef 100644 --- a/src/http/modules/ngx_http_static_handler.c +++ b/src/http/modules/ngx_http_static_handler.c @@ -115,18 +115,27 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r) * in a possible redirect and for the last '\0' */ - name.data = ngx_palloc(r->pool, clcf->root.len + r->uri.len + 2 - - clcf->alias * clcf->name.len); - if (name.data == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - location.data = ngx_cpymem(name.data, clcf->root.data, clcf->root.len); - if (clcf->alias) { - last = ngx_cpystrn(location.data, r->uri.data + clcf->name.len, + name.data = ngx_palloc(r->pool, clcf->root.len + r->uri.len + 2 + - clcf->name.len); + if (name.data == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + last = ngx_cpymem(name.data, clcf->root.data, clcf->root.len); + last = ngx_cpystrn(last, r->uri.data + clcf->name.len, r->uri.len + 1 - clcf->name.len); + name.len = last - name.data; + + location.data = ngx_palloc(r->pool, r->uri.len + 2); + if (location.data == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + last = ngx_cpystrn(location.data, r->uri.data, r->uri.len + 1); + +#if 0 /* * aliases usually have trailling "/", * set it in the start of the possible redirect @@ -135,13 +144,22 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r) if (*location.data != '/') { location.data--; } +#endif + + location.len = last - location.data + 1; } else { + name.data = ngx_palloc(r->pool, clcf->root.len + r->uri.len + 2); + if (name.data == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + location.data = ngx_cpymem(name.data, clcf->root.data, clcf->root.len); last = ngx_cpystrn(location.data, r->uri.data, r->uri.len + 1); - } - name.len = last - name.data; - location.len = last - location.data + 1; + name.len = last - name.data; + location.len = last - location.data + 1; + } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http filename: \"%s\"", name.data); |