Mercurial > hg > nginx
diff src/http/modules/ngx_http_static_module.c @ 577:4d9ea73a627a release-0.3.10
nginx-0.3.10-RELEASE import
*) Change: the "valid_referers" directive and the "$invalid_referer"
variable were moved to the new ngx_http_referer_module from the
ngx_http_rewrite_module.
*) Change: the "$apache_bytes_sent" variable name was changed to
"$body_bytes_sent".
*) Feature: the "$sent_http_..." variables.
*) Feature: the "if" directive supports the "=" and "!=" operations.
*) Feature: the "proxy_pass" directive supports the HTTPS protocol.
*) Feature: the "proxy_set_body" directive.
*) Feature: the "post_action" directive.
*) Feature: the ngx_http_empty_gif_module.
*) Feature: the "worker_cpu_affinity" directive for Linux.
*) Bugfix: the "rewrite" directive did not unescape URI part in
redirect, now it is unescaped except the %00-%25 and %7F-%FF
characters.
*) Bugfix: nginx could not be built by the icc 9.0 compiler.
*) Bugfix: if the SSI was enabled for zero size static file, then the
chunked response was encoded incorrectly.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 15 Nov 2005 13:30:52 +0000 |
parents | 58475592100c |
children | 326634fb9d47 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_static_module.c Thu Nov 10 07:44:53 2005 +0000 +++ b/src/http/modules/ngx_http_static_module.c Tue Nov 15 13:30:52 2005 +0000 @@ -44,13 +44,13 @@ NULL, /* create main configuration */ NULL, /* init main configuration */ - + NULL, /* create server configuration */ NULL, /* merge server configuration */ - + ngx_http_static_create_loc_conf, /* create location configuration */ ngx_http_static_merge_loc_conf /* merge location configuration */ -}; +}; ngx_module_t ngx_http_static_module = { @@ -240,33 +240,23 @@ r->headers_out.content_length_n = ngx_file_size(&fi); r->headers_out.last_modified_time = ngx_file_mtime(&fi); - if (r->headers_out.content_length_n == 0) { - r->header_only = 1; - } - if (ngx_http_set_content_type(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } -#if (NGX_SUPPRESS_WARN) - b = NULL; -#endif + /* we need to allocate all before the header would be sent */ - if (!r->header_only) { - /* we need to allocate all before the header would be sent */ + b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); + if (b == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } - b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); - if (b == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } + b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); + if (b->file == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } - b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); - if (b->file == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - r->filter_allow_ranges = 1; - } + r->filter_allow_ranges = 1; rc = ngx_http_send_header(r); @@ -274,17 +264,13 @@ return rc; } - b->in_file = 1; - - if (r->main == r) { - b->last_buf = 1; - } - - b->last_in_chain = 1; - b->file_pos = 0; b->file_last = ngx_file_size(&fi); + b->in_file = b->file_last ? 1: 0; + b->last_buf = (r->main == r) ? 1: 0; + b->last_in_chain = 1; + b->file->fd = fd; b->file->name = path; b->file->log = log; @@ -333,7 +319,7 @@ ngx_http_core_main_conf_t *cmcf; cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module); - + h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers); if (h == NULL) { return NGX_ERROR;