aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_static_handler.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-02-09 07:46:43 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-02-09 07:46:43 +0000
commit7af6b16936b630feabecbce0dbc9cf84b4943481 (patch)
tree18301d35a84907e66fe94ddc7600d4ec6d600409 /src/http/modules/ngx_http_static_handler.c
parent9260294400c902904cdf791c9c2e8fd069feec63 (diff)
downloadnginx-7af6b16936b630feabecbce0dbc9cf84b4943481.tar.gz
nginx-7af6b16936b630feabecbce0dbc9cf84b4943481.zip
nginx-0.0.2-2004-02-09-10:46:43 import
Diffstat (limited to 'src/http/modules/ngx_http_static_handler.c')
-rw-r--r--src/http/modules/ngx_http_static_handler.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index 31dd1fb58..617bb4d80 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -87,8 +87,8 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
}
/*
- * there is a valid cached open file, i.e by index handler,
- * and it must be already registered in r->cleanup
+ * there is a valid cached open file, i.e by the index handler,
+ * and it should be already registered in r->cleanup
*/
if (r->cache && !r->cache->expired) {
@@ -100,13 +100,14 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
/*
- * make a file name
- * 2 bytes is for a trailing '/' in a possible redirect and for '\0'
+ * make a file name, reserve 2 bytes for a trailing '/'
+ * in a possible redirect and for the last '\0'
*/
- ngx_test_null(name.data,
- ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2),
- NGX_HTTP_INTERNAL_SERVER_ERROR);
+ name.data = ngx_palloc(r->pool, clcf->doc_root.len + r->uri.len + 2);
+ if (name.data == NULL) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
location.data = ngx_cpymem(name.data, clcf->doc_root.data,
clcf->doc_root.len);