diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-07-07 16:33:19 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-07-07 16:33:19 +0000 |
commit | 1765f475445a054994611d2053cc181fb3504615 (patch) | |
tree | a816e7cada7b3bec35e866ee9b22f78bda6c5af8 /src/http/modules | |
parent | b798d507122449c1baa85b1de47eec31cc0487a6 (diff) | |
download | nginx-release-0.3.53.tar.gz nginx-release-0.3.53.zip |
nginx-0.3.53-RELEASE importrelease-0.3.53
*) Change: the "add_header" directive adds the string to 204, 301, and
302 responses.
*) Feature: the "server" directive in the "upstream" context supports
the "weight" parameter.
*) Feature: the "server_name" directive supports the "*" wildcard.
*) Feature: nginx supports the request body size more than 2G.
*) Bugfix: if a client was successfully authorized using "satisfy_any
on", then anyway the message "access forbidden by rule" was written
in the log.
*) Bugfix: the "PUT" method may erroneously not create a file and
return the 409 code.
*) Bugfix: if the IMAP/POP3 backend returned an error, then nginx
continued proxying anyway.
Diffstat (limited to 'src/http/modules')
-rw-r--r-- | src/http/modules/ngx_http_access_module.c | 9 | ||||
-rw-r--r-- | src/http/modules/ngx_http_auth_basic_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_charset_filter_module.c | 45 | ||||
-rw-r--r-- | src/http/modules/ngx_http_dav_module.c | 21 | ||||
-rw-r--r-- | src/http/modules/ngx_http_fastcgi_module.c | 18 | ||||
-rw-r--r-- | src/http/modules/ngx_http_gzip_filter_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_headers_filter_module.c | 9 | ||||
-rw-r--r-- | src/http/modules/ngx_http_log_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_memcached_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_proxy_module.c | 17 | ||||
-rw-r--r-- | src/http/modules/ngx_http_realip_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_rewrite_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_userid_filter_module.c | 4 | ||||
-rw-r--r-- | src/http/modules/perl/ngx_http_perl_module.c | 4 |
14 files changed, 82 insertions, 57 deletions
diff --git a/src/http/modules/ngx_http_access_module.c b/src/http/modules/ngx_http_access_module.c index 710dd248e..b8aa3aae2 100644 --- a/src/http/modules/ngx_http_access_module.c +++ b/src/http/modules/ngx_http_access_module.c @@ -92,6 +92,7 @@ ngx_http_access_handler(ngx_http_request_t *r) ngx_uint_t i; struct sockaddr_in *sin; ngx_http_access_rule_t *rule; + ngx_http_core_loc_conf_t *clcf; ngx_http_access_loc_conf_t *alcf; alcf = ngx_http_get_module_loc_conf(r, ngx_http_access_module); @@ -113,8 +114,12 @@ ngx_http_access_handler(ngx_http_request_t *r) if ((sin->sin_addr.s_addr & rule[i].mask) == rule[i].addr) { if (rule[i].deny) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "access forbidden by rule"); + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + + if (!clcf->satisfy_any) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "access forbidden by rule"); + } return NGX_HTTP_FORBIDDEN; } diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c index d33e7f6cf..5dd287609 100644 --- a/src/http/modules/ngx_http_auth_basic_module.c +++ b/src/http/modules/ngx_http_auth_basic_module.c @@ -136,7 +136,7 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r) fd = ngx_open_file(alcf->user_file.data, NGX_FILE_RDONLY, NGX_FILE_OPEN); if (fd == NGX_INVALID_FILE) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, + ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, ngx_open_file_n " \"%s\" failed", alcf->user_file.data); return NGX_HTTP_INTERNAL_SERVER_ERROR; } diff --git a/src/http/modules/ngx_http_charset_filter_module.c b/src/http/modules/ngx_http_charset_filter_module.c index 41a0e5751..0bc31bca5 100644 --- a/src/http/modules/ngx_http_charset_filter_module.c +++ b/src/http/modules/ngx_http_charset_filter_module.c @@ -188,7 +188,7 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) { u_char *ct; ngx_int_t charset, source_charset; - ngx_str_t *mc; + ngx_str_t *mc, *from, *to; ngx_uint_t n; ngx_http_charset_t *charsets; ngx_http_charset_ctx_t *ctx; @@ -288,13 +288,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) return ngx_http_next_header_filter(r); } - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no \"charset_map\" between the charsets " - "\"%V\" and \"%V\"", - &charsets[lcf->source_charset].name, - &r->main->headers_out.charset); + from = &charsets[lcf->source_charset].name; + to = &r->main->headers_out.charset; - return ngx_http_next_header_filter(r); + goto no_charset_map; } source_charset = ngx_http_charset_get_charset(charsets, n, @@ -308,11 +305,12 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) r->headers_out.charset.data) != 0) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no \"charset_map\" between the charsets " - "\"%V\" and \"%V\"", - &r->headers_out.charset, - &r->main->headers_out.charset); + from = &r->headers_out.charset; + to = (charset == NGX_HTTP_NO_CHARSET) ? + &r->main->headers_out.charset: + &charsets[charset].name; + + goto no_charset_map; } return ngx_http_next_header_filter(r); @@ -322,18 +320,24 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) && (charsets[source_charset].tables == NULL || charsets[source_charset].tables[charset] == NULL)) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "no \"charset_map\" between the charsets " - "\"%V\" and \"%V\"", - &charsets[source_charset].name, &charsets[charset].name); + from = &charsets[source_charset].name; + to = &charsets[charset].name; - return ngx_http_next_header_filter(r); + goto no_charset_map; } r->headers_out.content_type.len = r->headers_out.content_type_len; return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset, source_charset); + +no_charset_map: + + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "no \"charset_map\" between the charsets " + "\"%V\" and \"%V\"", from, to); + + return ngx_http_next_header_filter(r); } @@ -392,11 +396,14 @@ ngx_http_charset_set_charset(ngx_http_request_t *r, ctx->from_utf8 = charsets[source_charset].utf8; ctx->to_utf8 = charsets[charset].utf8; + r->filter_need_in_memory = 1; + if ((ctx->to_utf8 || ctx->from_utf8) && r == r->main) { ngx_http_clear_content_length(r); - } - r->filter_need_in_memory = 1; + } else { + r->filter_need_temporary = 1; + } return ngx_http_next_header_filter(r); } diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c index 7f61774e7..53ef21c45 100644 --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -251,17 +251,20 @@ ngx_http_dav_put_handler(ngx_http_request_t *r) } else { status = NGX_HTTP_NO_CONTENT; - } - if (ngx_is_dir(&fi)) { - if (ngx_delete_file(temp->data) == NGX_FILE_ERROR) { - ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, - ngx_delete_file_n " \"%s\" failed", - temp->data); - } + if (ngx_is_dir(&fi)) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_EISDIR, + "\"%s\" could not be created", path.data); + + if (ngx_delete_file(temp->data) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, + ngx_delete_file_n " \"%s\" failed", + temp->data); + } - ngx_http_finalize_request(r, NGX_HTTP_CONFLICT); - return; + ngx_http_finalize_request(r, NGX_HTTP_CONFLICT); + return; + } } if (ngx_rename_file(temp->data, path.data) != NGX_FILE_ERROR) { diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c index 085fb47e4..172a1a74d 100644 --- a/src/http/modules/ngx_http_fastcgi_module.c +++ b/src/http/modules/ngx_http_fastcgi_module.c @@ -1565,6 +1565,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) uintptr_t *code; ngx_str_t *header; ngx_uint_t i, j; + ngx_peer_t *peer; ngx_array_t hide_headers; ngx_keyval_t *src; ngx_hash_key_t *hk; @@ -1693,20 +1694,23 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |NGX_HTTP_UPSTREAM_FT_ERROR |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); - ngx_conf_merge_unsigned_value(conf->upstream.max_fails, + ngx_conf_merge_uint_value(conf->upstream.max_fails, prev->upstream.max_fails, 1); ngx_conf_merge_sec_value(conf->upstream.fail_timeout, prev->upstream.fail_timeout, 10); - if (conf->upstream_peers && !conf->upstream_peers->balanced) { + if (conf->upstream_peers) { + peer = conf->upstream_peers->peers->peer; for (i = 0; i < conf->upstream_peers->peers->number; i++) { - conf->upstream_peers->peers->peer[i].weight = 1; - conf->upstream_peers->peers->peer[i].max_fails = - conf->upstream.max_fails; - conf->upstream_peers->peers->peer[i].fail_timeout = - conf->upstream.fail_timeout; + ngx_conf_init_uint_value(peer[i].weight, 1); + peer[i].current_weight = peer[i].weight; + ngx_conf_init_uint_value(peer[i].max_fails, + conf->upstream.max_fails); + ngx_conf_init_value(peer[i].fail_timeout, + conf->upstream.fail_timeout); } + } ngx_conf_merge_path_value(conf->upstream.temp_path, diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c index a08f31cb5..26c164990 100644 --- a/src/http/modules/ngx_http_gzip_filter_module.c +++ b/src/http/modules/ngx_http_gzip_filter_module.c @@ -1087,7 +1087,7 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 4, ngx_pagesize); - ngx_conf_merge_unsigned_value(conf->http_version, prev->http_version, + ngx_conf_merge_uint_value(conf->http_version, prev->http_version, NGX_HTTP_VERSION_11); ngx_conf_merge_bitmask_value(conf->proxied, prev->proxied, (NGX_CONF_BITMASK_SET|NGX_HTTP_GZIP_PROXIED_OFF)); diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c index 8ced8e024..8065742a0 100644 --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -103,9 +103,12 @@ ngx_http_headers_filter(ngx_http_request_t *r) ngx_http_header_val_t *h; ngx_http_headers_conf_t *conf; - if ((r->headers_out.status != NGX_HTTP_OK - && r->headers_out.status != NGX_HTTP_NOT_MODIFIED) - || r != r->main) + if (r != r->main + || (r->headers_out.status != NGX_HTTP_OK + && r->headers_out.status != NGX_HTTP_NO_CONTENT + && r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY + && r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY + && r->headers_out.status != NGX_HTTP_NOT_MODIFIED)) { return ngx_http_next_header_filter(r); } diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c index 5e1636385..f85a6c829 100644 --- a/src/http/modules/ngx_http_log_module.c +++ b/src/http/modules/ngx_http_log_module.c @@ -478,7 +478,7 @@ static u_char * ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op) { - return ngx_sprintf(buf, "%z", r->request_length); + return ngx_sprintf(buf, "%O", r->request_length); } diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c index 5b07dbc52..000622d94 100644 --- a/src/http/modules/ngx_http_memcached_module.c +++ b/src/http/modules/ngx_http_memcached_module.c @@ -560,7 +560,7 @@ ngx_http_memcached_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |NGX_HTTP_UPSTREAM_FT_ERROR |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); - ngx_conf_merge_unsigned_value(conf->upstream.max_fails, + ngx_conf_merge_uint_value(conf->upstream.max_fails, prev->upstream.max_fails, 1); ngx_conf_merge_sec_value(conf->upstream.fail_timeout, diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index f14151ae8..ff5b129a8 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -1520,6 +1520,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) uintptr_t *code; ngx_str_t *header; ngx_uint_t i, j; + ngx_peer_t *peer; ngx_array_t hide_headers; ngx_keyval_t *src, *s, *h; ngx_hash_key_t *hk; @@ -1647,19 +1648,21 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |NGX_HTTP_UPSTREAM_FT_ERROR |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); - ngx_conf_merge_unsigned_value(conf->upstream.max_fails, + ngx_conf_merge_uint_value(conf->upstream.max_fails, prev->upstream.max_fails, 1); ngx_conf_merge_sec_value(conf->upstream.fail_timeout, prev->upstream.fail_timeout, 10); - if (conf->upstream_peers && !conf->upstream_peers->balanced) { + if (conf->upstream_peers) { + peer = conf->upstream_peers->peers->peer; for (i = 0; i < conf->upstream_peers->peers->number; i++) { - conf->upstream_peers->peers->peer[i].weight = 1; - conf->upstream_peers->peers->peer[i].max_fails = - conf->upstream.max_fails; - conf->upstream_peers->peers->peer[i].fail_timeout = - conf->upstream.fail_timeout; + ngx_conf_init_uint_value(peer[i].weight, 1); + peer[i].current_weight = peer[i].weight; + ngx_conf_init_uint_value(peer[i].max_fails, + conf->upstream.max_fails); + ngx_conf_init_value(peer[i].fail_timeout, + conf->upstream.fail_timeout); } } diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c index 210bbf6f3..3940ee442 100644 --- a/src/http/modules/ngx_http_realip_module.c +++ b/src/http/modules/ngx_http_realip_module.c @@ -243,7 +243,7 @@ ngx_http_realip_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) conf->from = prev->from; } - ngx_conf_merge_unsigned_value(conf->xfwd, prev->xfwd, 0); + ngx_conf_merge_uint_value(conf->xfwd, prev->xfwd, 0); return NGX_CONF_OK; } diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c index c557314ee..88988bdf0 100644 --- a/src/http/modules/ngx_http_rewrite_module.c +++ b/src/http/modules/ngx_http_rewrite_module.c @@ -245,7 +245,7 @@ ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_value(conf->log, prev->log, 0); ngx_conf_merge_value(conf->uninitialized_variable_warn, prev->uninitialized_variable_warn, 1); - ngx_conf_merge_unsigned_value(conf->stack_size, prev->stack_size, 10); + ngx_conf_merge_uint_value(conf->stack_size, prev->stack_size, 10); if (conf->codes == NULL) { return NGX_CONF_OK; diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c index 92c53f83e..bdad35dd7 100644 --- a/src/http/modules/ngx_http_userid_filter_module.c +++ b/src/http/modules/ngx_http_userid_filter_module.c @@ -670,8 +670,8 @@ ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent, void *child) ngx_http_userid_conf_t *prev = parent; ngx_http_userid_conf_t *conf = child; - ngx_conf_merge_unsigned_value(conf->enable, prev->enable, - NGX_HTTP_USERID_OFF); + ngx_conf_merge_uint_value(conf->enable, prev->enable, + NGX_HTTP_USERID_OFF); ngx_conf_merge_str_value(conf->name, prev->name, "uid"); ngx_conf_merge_str_value(conf->domain, prev->domain, ""); diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c index 91a9c85ca..bf976e9f0 100644 --- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -833,9 +833,9 @@ ngx_http_perl_init_main_conf(ngx_conf_t *cf, void *conf) ngx_http_perl_main_conf_t *pmcf = conf; #if (NGX_HAVE_PERL_CLONE || NGX_HAVE_PERL_MULTIPLICITY) - ngx_conf_init_unsigned_value(pmcf->interp_max, 10); + ngx_conf_init_uint_value(pmcf->interp_max, 10); #else - ngx_conf_init_unsigned_value(pmcf->interp_max, 1); + ngx_conf_init_uint_value(pmcf->interp_max, 1); #endif pmcf->free_perls = ngx_pcalloc(cf->pool, |