summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_static_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-03-19 12:38:37 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-03-19 12:38:37 +0000
commitc15717285d2157a603bb1b130b26d7baa549be7e (patch)
tree56dc8346b22bb2660eecd3bc086d263ac6d67326 /src/http/modules/ngx_http_static_module.c
parente12fbfe82a176cd386cdcecfeabf43ac8fd870a4 (diff)
downloadnginx-release-0.1.25.tar.gz
nginx-release-0.1.25.tar.bz2
nginx-0.1.25-RELEASE importrelease-0.1.25
*) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
Diffstat (limited to '')
-rw-r--r--src/http/modules/ngx_http_static_module.c (renamed from src/http/modules/ngx_http_static_handler.c)40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_module.c
index 4f0f96dc0..c2c45828f 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -75,10 +75,13 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
ngx_buf_t *b;
ngx_chain_t out;
ngx_file_info_t fi;
- ngx_http_cleanup_t *file_cleanup, *redirect_cleanup;
+ ngx_http_cleanup_t *file_cleanup;
+#if (NGX_HTTP_CACHE)
+ ngx_http_cleanup_t *redirect_cleanup;
+#endif
ngx_http_core_loc_conf_t *clcf;
- ngx_http_static_loc_conf_t *slcf;
#if (NGX_HTTP_CACHE)
+ ngx_http_static_loc_conf_t *slcf;
uint32_t file_crc, redirect_crc;
ngx_http_cache_t *file, *redirect;
#endif
@@ -176,14 +179,18 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
/* allocate cleanups */
- if (!(file_cleanup = ngx_push_array(&r->cleanup))) {
+ file_cleanup = ngx_array_push(&r->cleanup);
+ if (file_cleanup == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
file_cleanup->valid = 0;
+#if (NGX_HTTP_CACHE)
+
slcf = ngx_http_get_module_loc_conf(r, ngx_http_static_module);
if (slcf->redirect_cache) {
- if (!(redirect_cleanup = ngx_push_array(&r->cleanup))) {
+ redirect_cleanup = ngx_array_push(&r->cleanup);
+ if (redirect_cleanup == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
redirect_cleanup->valid = 0;
@@ -192,8 +199,6 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
redirect_cleanup = NULL;
}
-#if (NGX_HTTP_CACHE)
-
/* look up an open files cache */
if (clcf->open_files) {
@@ -232,9 +237,9 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
* should keep more popular redirects in cache.
*/
- if (!(r->headers_out.location =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
- {
+ r->headers_out.location = ngx_http_add_header(&r->headers_out,
+ ngx_http_headers_out);
+ if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -283,9 +288,9 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0,
"HTTP DIR: \"%s\"", name.data);
- if (!(r->headers_out.location =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
- {
+ r->headers_out.location = ngx_http_add_header(&r->headers_out,
+ ngx_http_headers_out);
+ if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -506,11 +511,13 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
if (!r->header_only) {
/* we need to allocate all before the header would be sent */
- if (!(b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)))) {
+ b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+ if (b == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- if (!(b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)))) {
+ b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
+ if (b->file == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -547,7 +554,8 @@ static void *ngx_http_static_create_loc_conf(ngx_conf_t *cf)
{
ngx_http_static_loc_conf_t *conf;
- if (!(conf = ngx_palloc(cf->pool, sizeof(ngx_http_static_loc_conf_t)))) {
+ conf = ngx_palloc(cf->pool, sizeof(ngx_http_static_loc_conf_t));
+ if (conf == NULL) {
return NGX_CONF_ERROR;
}
@@ -578,7 +586,7 @@ static ngx_int_t ngx_http_static_init(ngx_cycle_t *cycle)
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
- h = ngx_push_array(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
+ h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
if (h == NULL) {
return NGX_ERROR;
}