mirror of
https://github.com/nginx/nginx.git
synced 2024-12-22 15:13:28 -06:00
nginx-0.2.6-RELEASE import
*) Change: while using load-balancing the time before the failed backend retry was decreased from 60 to 10 seconds. *) Change: the "proxy_pass_unparsed_uri" was canceled, the original URI now passed, if the URI part is omitted in "proxy_pass" directive. *) Feature: the "error_page" directive supports redirects and allows more flexible to change an error code. *) Change: the charset in the "Content-Type" header line now is ignored in proxied subrequests. *) Bugfix: if the URI was changed in the "if" block and request did not found new configuration, then the ngx_http_rewrite_module rules ran again. *) Bugfix: if the "set" directive set the ngx_http_geo_module variable in some configuration part, the this variable was not available in other configuration parts and the "using uninitialized variable" error was occurred; the bug had appeared in 0.2.2.
This commit is contained in:
parent
c6806be34f
commit
a257367813
@ -90,9 +90,11 @@ CFLAGS="$CFLAGS -wd981"
|
||||
CFLAGS="$CFLAGS -wd1418"
|
||||
# external declaration in primary source file
|
||||
CFLAGS="$CFLAGS -wd1419"
|
||||
# explicit conversion of a 64-bit integral type to a smaller integral type
|
||||
CFLAGS="$CFLAGS -wd1683"
|
||||
|
||||
case "$NGX_ICC_VER" in
|
||||
8.*)
|
||||
8.* | 9.*)
|
||||
# "cc" clobber ignored, warnings for Liunx's htons()
|
||||
CFLAGS="$CFLAGS -wd1469"
|
||||
|
||||
|
@ -9,12 +9,87 @@
|
||||
<title lang="en">nginx changelog</title>
|
||||
|
||||
|
||||
<changes ver="0.2.6" date="05.10.2005">
|
||||
|
||||
<change type="change">
|
||||
<para lang="ru">
|
||||
Ó 60 ÄÏ 10 ÓÅËÕÎÄ ÕÍÅÎØÛÅÎÏ ×ÒÅÍÑ ÐÏ×ÔÏÒÎÏÇÏ ÏÂÒÁÝÅÎÉÑ Ë ÂÜËÅÎÄÕ
|
||||
ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÒÁÓÐÒÅÄÅÌÅÎÉÑ ÎÁÇÒÕÚËÉ.
|
||||
</para>
|
||||
<para lang="en">
|
||||
while using load-balancing the time before the failed backend retry
|
||||
was decreased from 60 to 10 seconds.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="change">
|
||||
<para lang="ru">
|
||||
ÄÉÒÅËÔÉ×Á proxy_pass_unparsed_uri ÕÐÒÁÚÄÎÅÎÁ, ÏÒÉÇÉÎÁÌØÎÙÊ ÚÁÐÒÏÓ ÔÅÐÅÒØ
|
||||
ÐÅÒÅÄÁ£ÔÓÑ, ÅÓÌÉ × ÄÉÒÅËÔÉ×Å proxy_pass ÏÔÓÕÔÓÔ×ÕÅÔ URI.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the "proxy_pass_unparsed_uri" was canceled, the original URI now passed,
|
||||
if the URI part is omitted in "proxy_pass" directive.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="feature">
|
||||
<para lang="ru">
|
||||
ÄÉÒÅËÔÉ×Á error_page ÐÏÄÄÅÒÖÉ×ÁÅÔ ÒÅÄÉÒÅËÔÙ É ÐÏÚ×ÏÌÑÅÔ ÂÏÌÅÅ ÇÉÂËÏ
|
||||
ÍÅÎÑÔØ ËÏÄ ÏÛÉÂËÉ.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the "error_page" directive supports redirects and allows more flexible
|
||||
to change an error code.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="change">
|
||||
<para lang="ru">
|
||||
× ÐÒÏËÓÉÒÏ×ÁÎÎÙÈ ÐÏÄÚÁÐÒÏÓÁÈ ÔÅÐÅÒØ ÉÇÎÏÒÉÒÕÅÔÓÑ ÐÅÒÅÄÁÎÎÙÊ charset.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the charset in the "Content-Type" header line now is ignored
|
||||
in proxied subrequests.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="bugfix">
|
||||
<para lang="ru">
|
||||
ÅÓÌÉ ÐÏÓÌÅ ÉÚÍÅÎÅÎÉÑ URI × ÂÌÏËÅ if ÄÌÑ ÚÁÐÒÏÓÁ ÎÅ ÎÁÈÏÄÉÌÁÓØ
|
||||
ÎÏ×ÁÑ ËÏÎÆÉÇÕÒÁÃÉÑ, ÔÏ ÐÒÁ×ÉÌÁ ÍÏÄÕÌÑ ngx_http_rewrite_module ×ÙÐÏÌÎÑÌÉÓØ
|
||||
ÓÎÏ×Á.
|
||||
</para>
|
||||
<para lang="en">
|
||||
if the URI was changed in the "if" block and request did not found
|
||||
new configuration, then the ngx_http_rewrite_module rules ran again.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="bugfix">
|
||||
<para lang="ru">
|
||||
ÅÓÌÉ ÄÉÒÅËÔÉ×Á set ÕÓÔÁÎÁ×ÌÉ×ÁÌÁ ÐÅÒÅÍÅÎÎÕÀ ÍÏÄÕÌÑ ngx_http_geo_module
|
||||
× ËÁËÏÊ-ÌÉÂÏ ÞÁÓÔÉ ËÏÎÆÉÇÕÒÁÃÉÉ, ÔÏ ÜÔÁ ÐÅÒÅÍÅÎÎÁÑ ÎÅ ÂÙÌÁ ÄÏÓÔÕÐÎÁ ×
|
||||
ÄÒÕÇÉÈ ÞÁÓÔÑÈ ËÏÎÆÉÇÕÒÁÃÉÉ É ×ÙÄÁ×ÁÌÁÓØ ÏÛÉÂËÁ "using uninitialized variable";
|
||||
ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.2.2.
|
||||
</para>
|
||||
<para lang="en">
|
||||
if the "set" directive set the ngx_http_geo_module variable in some
|
||||
configuration part, the this variable was not available in other
|
||||
configuration parts and the "using uninitialized variable" error was occurred;
|
||||
bug appeared in 0.2.2.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
</changes>
|
||||
|
||||
|
||||
<changes ver="0.2.5" date="04.10.2005">
|
||||
|
||||
<change type="change">
|
||||
<para lang="ru">
|
||||
恼绿梢绽菖<EFBFBD> 谖赁盼膳 信遗团挝鲜 拖恼萄 ngx_http_geo_module 耘信邑
|
||||
выдаёт предупреждение и изменяёт старое значение.
|
||||
×ÙÄÁ£Ô ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ É ÉÚÍÅÎÑÅÔ ÓÔÁÒÏÅ ÚÎÁÞÅÎÉÅ.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the duplicate value of the ngx_http_geo_module variable now causes
|
||||
@ -47,7 +122,7 @@ the ngx_http_ssi_module supports the "file" parameter in the "include" command.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the ngx_http_ssi_module supports the variable value substitutions in
|
||||
epxiressions of the "if" command.
|
||||
expressions of the "if" command.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define _NGINX_H_INCLUDED_
|
||||
|
||||
|
||||
#define NGINX_VER "nginx/0.2.5"
|
||||
#define NGINX_VER "nginx/0.2.6"
|
||||
|
||||
#define NGINX_VAR "NGINX"
|
||||
#define NGX_OLDPID_EXT ".oldbin"
|
||||
|
@ -346,7 +346,7 @@ ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u)
|
||||
|
||||
peers->peer[i].weight = 1;
|
||||
peers->peer[i].max_fails = 1;
|
||||
peers->peer[i].fail_timeout = 60;
|
||||
peers->peer[i].fail_timeout = 10;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -471,7 +471,8 @@ ngx_inet_parse_host_port(ngx_inet_upstream_t *u)
|
||||
|
||||
} else {
|
||||
if (u->port_text.len == 0) {
|
||||
return "no URI";
|
||||
u->default_port = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
port = ngx_atoi(u->port_text.data, u->port_text.len);
|
||||
|
@ -34,13 +34,6 @@ ngx_unix_upstream_parse(ngx_conf_t *cf, ngx_unix_domain_upstream_t *u)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (u->uri.len == 0) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"the unix domain upstream \"%V\" has no URI",
|
||||
&u->name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
|
@ -162,7 +162,8 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
||||
return ngx_http_next_header_filter(r);
|
||||
}
|
||||
|
||||
if (ngx_strstr(r->headers_out.content_type.data, "charset") != NULL)
|
||||
if (r->main == r
|
||||
&& ngx_strstr(r->headers_out.content_type.data, "charset") != NULL)
|
||||
{
|
||||
return ngx_http_next_header_filter(r);
|
||||
}
|
||||
|
@ -148,11 +148,6 @@ static ngx_str_t ngx_http_fastcgi_script_name =
|
||||
ngx_string("fastcgi_script_name");
|
||||
|
||||
|
||||
#if (NGX_PCRE)
|
||||
static ngx_str_t ngx_http_fastcgi_uri = ngx_string("/");
|
||||
#endif
|
||||
|
||||
|
||||
static ngx_conf_post_t ngx_http_fastcgi_lowat_post =
|
||||
{ ngx_http_fastcgi_lowat_check };
|
||||
|
||||
@ -1448,7 +1443,6 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf)
|
||||
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
|
||||
conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
|
||||
|
||||
conf->upstream.pass_unparsed_uri = NGX_CONF_UNSET;
|
||||
conf->upstream.method = NGX_CONF_UNSET_UINT;
|
||||
conf->upstream.pass_request_headers = NGX_CONF_UNSET;
|
||||
conf->upstream.pass_request_body = NGX_CONF_UNSET;
|
||||
@ -1602,16 +1596,6 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
NGX_HTTP_FASTCGI_TEMP_PATH, 1, 2, 0,
|
||||
ngx_garbage_collector_temp_handler, cf);
|
||||
|
||||
ngx_conf_merge_value(conf->upstream.pass_unparsed_uri,
|
||||
prev->upstream.pass_unparsed_uri, 0);
|
||||
|
||||
if (conf->upstream.pass_unparsed_uri && conf->upstream.location->len > 1) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
||||
"\"fastcgi_pass_unparsed_uri\" can be set for "
|
||||
"location \"/\" or given by regular expression.");
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
if (conf->upstream.method == NGX_CONF_UNSET_UINT) {
|
||||
conf->upstream.method = prev->upstream.method;
|
||||
}
|
||||
@ -1812,6 +1796,10 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
ngx_unix_domain_upstream_t unix_upstream;
|
||||
#endif
|
||||
|
||||
if (lcf->upstream.schema.len) {
|
||||
return "is duplicate";
|
||||
}
|
||||
|
||||
value = cf->args->elts;
|
||||
|
||||
if (ngx_strncasecmp(value[1].data, "unix:", 5) == 0) {
|
||||
@ -1828,6 +1816,8 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
lcf->peers->peer[0].uri_separator = "";
|
||||
|
||||
#else
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"the unix domain sockets are not supported "
|
||||
@ -1850,18 +1840,12 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
lcf->upstream.schema.len = sizeof("fastcgi://") - 1;
|
||||
lcf->upstream.schema.data = (u_char *) "fastcgi://";
|
||||
lcf->upstream.uri.len = sizeof("/") - 1;
|
||||
lcf->upstream.uri.data = (u_char *) "/";
|
||||
|
||||
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
|
||||
|
||||
clcf->handler = ngx_http_fastcgi_handler;
|
||||
|
||||
#if (NGX_PCRE)
|
||||
lcf->upstream.location = clcf->regex ? &ngx_http_fastcgi_uri : &clcf->name;
|
||||
#else
|
||||
lcf->upstream.location = &clcf->name;
|
||||
#endif
|
||||
|
||||
if (clcf->name.data[clcf->name.len - 1] == '/') {
|
||||
clcf->auto_redirect = 1;
|
||||
|
@ -159,13 +159,6 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
||||
offsetof(ngx_http_proxy_loc_conf_t, upstream.redirect_errors),
|
||||
NULL },
|
||||
|
||||
{ ngx_string("proxy_pass_unparsed_uri"),
|
||||
NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
||||
ngx_conf_set_flag_slot,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_unparsed_uri),
|
||||
NULL },
|
||||
|
||||
{ ngx_string("proxy_set_header"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
|
||||
ngx_conf_set_table_elt_slot,
|
||||
@ -342,11 +335,6 @@ static ngx_http_variable_t ngx_http_proxy_vars[] = {
|
||||
};
|
||||
|
||||
|
||||
#if (NGX_PCRE)
|
||||
static ngx_str_t ngx_http_proxy_uri = ngx_string("/");
|
||||
#endif
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_proxy_handler(ngx_http_request_t *r)
|
||||
{
|
||||
@ -432,7 +420,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
|
||||
loc_len = r->valid_location ? u->conf->location->len : 0;
|
||||
|
||||
if (plcf->upstream.pass_unparsed_uri && r->valid_unparsed_uri) {
|
||||
if (u->conf->uri.len == 0 && r->valid_unparsed_uri) {
|
||||
len += r->unparsed_uri.len;
|
||||
|
||||
} else {
|
||||
@ -514,11 +502,15 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
r->method_name.len + 1);
|
||||
}
|
||||
|
||||
if (plcf->upstream.pass_unparsed_uri && r->valid_unparsed_uri) {
|
||||
u->uri.data = b->last;
|
||||
|
||||
if (u->conf->uri.len == 0 && r->valid_unparsed_uri) {
|
||||
b->last = ngx_cpymem(b->last, r->unparsed_uri.data,
|
||||
r->unparsed_uri.len);
|
||||
} else {
|
||||
b->last = ngx_cpymem(b->last, u->conf->uri.data, u->conf->uri.len);
|
||||
if (r->valid_location) {
|
||||
b->last = ngx_cpymem(b->last, u->conf->uri.data, u->conf->uri.len);
|
||||
}
|
||||
|
||||
if (escape) {
|
||||
ngx_escape_uri(b->last, r->uri.data + loc_len,
|
||||
@ -536,6 +528,8 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
|
||||
}
|
||||
}
|
||||
|
||||
u->uri.len = b->last - u->uri.data;
|
||||
|
||||
b->last = ngx_cpymem(b->last, ngx_http_proxy_version,
|
||||
sizeof(ngx_http_proxy_version) - 1);
|
||||
|
||||
@ -1312,7 +1306,6 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
||||
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
|
||||
conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
|
||||
|
||||
conf->upstream.pass_unparsed_uri = NGX_CONF_UNSET;
|
||||
conf->upstream.method = NGX_CONF_UNSET_UINT;
|
||||
conf->upstream.pass_request_headers = NGX_CONF_UNSET;
|
||||
conf->upstream.pass_request_body = NGX_CONF_UNSET;
|
||||
@ -1467,16 +1460,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
||||
NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0,
|
||||
ngx_garbage_collector_temp_handler, cf);
|
||||
|
||||
ngx_conf_merge_value(conf->upstream.pass_unparsed_uri,
|
||||
prev->upstream.pass_unparsed_uri, 0);
|
||||
|
||||
if (conf->upstream.pass_unparsed_uri && conf->upstream.location->len > 1) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
||||
"\"proxy_pass_unparsed_uri\" can be set for "
|
||||
"location \"/\" or given by regular expression.");
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
if (conf->upstream.method == NGX_CONF_UNSET_UINT) {
|
||||
conf->upstream.method = prev->upstream.method;
|
||||
}
|
||||
@ -1759,7 +1742,6 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_http_proxy_loc_conf_t *plcf = conf;
|
||||
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *value, *url;
|
||||
ngx_inet_upstream_t inet_upstream;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
@ -1767,6 +1749,10 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
ngx_unix_domain_upstream_t unix_upstream;
|
||||
#endif
|
||||
|
||||
if (plcf->upstream.schema.len) {
|
||||
return "is duplicate";
|
||||
}
|
||||
|
||||
value = cf->args->elts;
|
||||
|
||||
url = &value[1];
|
||||
@ -1792,8 +1778,6 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
plcf->peers->peer[0].uri_separator = ":";
|
||||
|
||||
plcf->host_header.len = sizeof("localhost") - 1;
|
||||
plcf->host_header.data = (u_char *) "localhost";
|
||||
plcf->upstream.uri = unix_upstream.uri;
|
||||
@ -1820,10 +1804,6 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < plcf->peers->number; i++) {
|
||||
plcf->peers->peer[i].uri_separator = "";
|
||||
}
|
||||
|
||||
plcf->host_header = inet_upstream.host_header;
|
||||
plcf->port_text = inet_upstream.port_text;
|
||||
plcf->upstream.uri = inet_upstream.uri;
|
||||
@ -1836,10 +1816,17 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
clcf->handler = ngx_http_proxy_handler;
|
||||
|
||||
#if (NGX_PCRE)
|
||||
plcf->upstream.location = clcf->regex ? &ngx_http_proxy_uri : &clcf->name;
|
||||
#else
|
||||
plcf->upstream.location = &clcf->name;
|
||||
|
||||
#if (NGX_PCRE)
|
||||
|
||||
if (clcf->regex && plcf->upstream.uri.len) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"\"proxy_pass\" may not have URI part in "
|
||||
"location given by regular expression");
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
plcf->upstream.url = *url;
|
||||
|
@ -691,7 +691,7 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
if (pclcf->locations.elts == NULL) {
|
||||
if (ngx_array_init(&pclcf->locations, cf->pool, 4, sizeof(void *))
|
||||
== NGX_ERROR)
|
||||
== NGX_ERROR)
|
||||
{
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
@ -759,6 +759,10 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
if_code->next = (u_char *) lcf->codes->elts + lcf->codes->nelts
|
||||
- (u_char *) if_code;
|
||||
|
||||
/* the code array belong to parent block */
|
||||
|
||||
nlcf->codes = NULL;
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
@ -1048,8 +1052,10 @@ ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
v->handler = ngx_http_rewrite_var;
|
||||
v->data = index;
|
||||
if (v->handler == NULL) {
|
||||
v->handler = ngx_http_rewrite_var;
|
||||
v->data = index;
|
||||
}
|
||||
|
||||
n = ngx_http_script_variables_count(&value[2]);
|
||||
|
||||
|
@ -626,6 +626,11 @@ ngx_http_find_location_config(ngx_http_request_t *r)
|
||||
return NGX_HTTP_NOT_FOUND;
|
||||
}
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"using configuration \"%s%V\"",
|
||||
(clcf->noname ? "*" : (clcf->exact_match ? "=" : "")),
|
||||
&clcf->name);
|
||||
|
||||
ngx_http_update_location_config(r);
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
@ -708,7 +713,8 @@ ngx_http_core_find_location(ngx_http_request_t *r,
|
||||
ngx_uint_t i, found, noregex;
|
||||
ngx_http_core_loc_conf_t *clcf, **clcfp;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "find location");
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"find location for \"%V\"", &r->uri);
|
||||
|
||||
found = 0;
|
||||
noregex = 0;
|
||||
@ -907,7 +913,7 @@ ngx_http_set_content_type(ngx_http_request_t *r)
|
||||
ngx_int_t
|
||||
ngx_http_send_header(ngx_http_request_t *r)
|
||||
{
|
||||
if (r->err_ctx) {
|
||||
if (r->err_status) {
|
||||
r->headers_out.status = r->err_status;
|
||||
r->headers_out.status_line.len = 0;
|
||||
}
|
||||
@ -2237,18 +2243,23 @@ ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1);
|
||||
if (value[i].len > 1) {
|
||||
overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1);
|
||||
|
||||
if (overwrite == NGX_ERROR) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"invalid value \"%V\"", &value[i]);
|
||||
return NGX_CONF_ERROR;
|
||||
if (overwrite == NGX_ERROR) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"invalid value \"%V\"", &value[i]);
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
} else {
|
||||
overwrite = 0;
|
||||
}
|
||||
|
||||
n = 2;
|
||||
|
||||
} else {
|
||||
overwrite = 0;
|
||||
overwrite = -1;
|
||||
n = 1;
|
||||
}
|
||||
|
||||
@ -2273,7 +2284,8 @@ ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
err->overwrite = overwrite;
|
||||
err->overwrite = (overwrite >= 0) ? overwrite : err->status;
|
||||
|
||||
err->uri = value[cf->args->nelts - 1];
|
||||
}
|
||||
|
||||
|
@ -283,18 +283,31 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
|
||||
for (i = 0; i < clcf->error_pages->nelts; i++) {
|
||||
|
||||
if (err_page[i].status == error) {
|
||||
|
||||
if (err_page[i].overwrite) {
|
||||
r->err_status = err_page[i].overwrite;
|
||||
} else {
|
||||
r->err_status = error;
|
||||
}
|
||||
|
||||
r->err_status = err_page[i].overwrite;
|
||||
r->err_ctx = r->ctx;
|
||||
|
||||
r->method = NGX_HTTP_GET;
|
||||
|
||||
return ngx_http_internal_redirect(r, &err_page[i].uri, NULL);
|
||||
if (err_page[i].uri.data[0] == '/') {
|
||||
return ngx_http_internal_redirect(r, &err_page[i].uri,
|
||||
NULL);
|
||||
}
|
||||
|
||||
r->headers_out.location =
|
||||
ngx_list_push(&r->headers_out.headers);
|
||||
|
||||
if (r->headers_out.location) {
|
||||
r->err_status = NGX_HTTP_MOVED_TEMPORARILY;
|
||||
error = NGX_HTTP_MOVED_TEMPORARILY;
|
||||
|
||||
r->headers_out.location->hash = 1;
|
||||
r->headers_out.location->key.len = sizeof("Location") - 1;
|
||||
r->headers_out.location->key.data = (u_char *) "Location";
|
||||
r->headers_out.location->value = err_page[i].uri;
|
||||
|
||||
} else {
|
||||
error = NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1793,8 +1793,6 @@ static u_char *
|
||||
ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len)
|
||||
{
|
||||
u_char *p;
|
||||
ngx_str_t line;
|
||||
uintptr_t escape;
|
||||
ngx_http_upstream_t *u;
|
||||
ngx_peer_connection_t *peer;
|
||||
|
||||
@ -1809,62 +1807,10 @@ ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len)
|
||||
&u->conf->schema,
|
||||
&peer->peers->peer[peer->cur_peer].name,
|
||||
peer->peers->peer[peer->cur_peer].uri_separator,
|
||||
&u->conf->uri);
|
||||
&u->uri);
|
||||
len -= p - buf;
|
||||
buf = p;
|
||||
|
||||
if (r->quoted_uri) {
|
||||
escape = 2 * ngx_escape_uri(NULL, r->uri.data + u->conf->location->len,
|
||||
r->uri.len - u->conf->location->len,
|
||||
NGX_ESCAPE_URI);
|
||||
} else {
|
||||
escape = 0;
|
||||
}
|
||||
|
||||
if (escape) {
|
||||
if (len >= r->uri.len - u->conf->location->len + escape) {
|
||||
|
||||
ngx_escape_uri(buf, r->uri.data + u->conf->location->len,
|
||||
r->uri.len - u->conf->location->len, NGX_ESCAPE_URI);
|
||||
|
||||
buf += r->uri.len - u->conf->location->len + escape;
|
||||
len -= r->uri.len - u->conf->location->len + escape;
|
||||
|
||||
} else {
|
||||
p = ngx_palloc(r->pool,
|
||||
r->uri.len - u->conf->location->len + escape);
|
||||
if (p == NULL) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
ngx_escape_uri(p, r->uri.data + u->conf->location->len,
|
||||
r->uri.len - u->conf->location->len, NGX_ESCAPE_URI);
|
||||
|
||||
line.len = len;
|
||||
line.data = p;
|
||||
|
||||
return ngx_snprintf(buf, len, "%V", &line);
|
||||
}
|
||||
|
||||
} else {
|
||||
line.len = r->uri.len - u->conf->location->len;
|
||||
if (line.len > len) {
|
||||
line.len = len;
|
||||
}
|
||||
|
||||
line.data = r->uri.data + u->conf->location->len;
|
||||
p = ngx_snprintf(buf, len, "%V", &line);
|
||||
|
||||
len -= p - buf;
|
||||
buf = p;
|
||||
}
|
||||
|
||||
if (r->args.len) {
|
||||
p = ngx_snprintf(buf, len, "?%V", &r->args);
|
||||
len -= p - buf;
|
||||
buf = p;
|
||||
}
|
||||
|
||||
return ngx_http_log_error_info(r, buf, len);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,6 @@ typedef struct {
|
||||
ngx_flag_t pass_request_body;
|
||||
|
||||
ngx_flag_t redirect_errors;
|
||||
ngx_flag_t pass_unparsed_uri;
|
||||
ngx_flag_t cyclic_temp_file;
|
||||
|
||||
ngx_flag_t pass_x_powered_by;
|
||||
@ -164,6 +163,8 @@ struct ngx_http_upstream_s {
|
||||
ngx_http_upstream_state_t *state;
|
||||
ngx_array_t states; /* of ngx_http_upstream_state_t */
|
||||
|
||||
ngx_str_t uri;
|
||||
|
||||
unsigned cachable:1;
|
||||
unsigned accel:1;
|
||||
|
||||
|
@ -1068,7 +1068,6 @@ ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
ngx_imap_auth_http_conf_t *ahcf = conf;
|
||||
|
||||
ngx_uint_t i;
|
||||
ngx_str_t *value, *url;
|
||||
ngx_inet_upstream_t inet_upstream;
|
||||
#if (NGX_HAVE_UNIX_DOMAIN)
|
||||
@ -1094,8 +1093,6 @@ ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
ahcf->peers->peer[0].uri_separator = ":";
|
||||
|
||||
ahcf->host_header.len = sizeof("localhost") - 1;
|
||||
ahcf->host_header.data = (u_char *) "localhost";
|
||||
ahcf->uri = unix_upstream.uri;
|
||||
@ -1121,13 +1118,14 @@ ngx_imap_auth_http(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < ahcf->peers->number; i++) {
|
||||
ahcf->peers->peer[i].uri_separator = "";
|
||||
}
|
||||
|
||||
ahcf->host_header = inet_upstream.host_header;
|
||||
ahcf->uri = inet_upstream.uri;
|
||||
}
|
||||
|
||||
if (ahcf->uri.len) {
|
||||
ahcf->uri.len = sizeof("/") - 1;
|
||||
ahcf->uri.data = (u_char *) "/";
|
||||
}
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
||||
size = cl->buf->last - cl->buf->pos;
|
||||
|
||||
if (send + size > limit) {
|
||||
size = limit - send;
|
||||
size = (ssize_t) limit - send;
|
||||
}
|
||||
|
||||
if (prev == cl->buf->pos) {
|
||||
|
Loading…
Reference in New Issue
Block a user