mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
nginx-0.3.31-RELEASE import
*) Change: now nginx passes the malformed proxied backend responses.
*) Feature: the "listen" directives support the address in the "*:port"
form.
*) Feature: the EVFILER_TIMER support in MacOSX 10.4.
*) Workaround: for MacOSX 64-bit kernel kqueue millisecond timeout
bug.
Thanks to Andrei Nigmatulin.
*) Bugfix: if there were several "listen" directives listening one
various addresses inside one server, then server names like
"*.domain.tld" worked for first address only; the bug had appeared
in 0.3.18.
*) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive
and the request body was in temporarily file then the request was
not transferred.
*) Bugfix: perl 5.8.8 compatibility.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#define _NGINX_H_INCLUDED_
|
||||
|
||||
|
||||
#define NGINX_VER "nginx/0.3.30"
|
||||
#define NGINX_VER "nginx/0.3.31"
|
||||
|
||||
#define NGINX_VAR "NGINX"
|
||||
#define NGX_OLDPID_EXT ".oldbin"
|
||||
|
||||
@@ -741,10 +741,10 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
|
||||
ngx_uint_t flags)
|
||||
{
|
||||
size_t len;
|
||||
u_char *reverse;
|
||||
ngx_str_t *name;
|
||||
ngx_uint_t i, k, n, skip;
|
||||
ngx_hash_key_t *hk;
|
||||
u_char buf[2048];
|
||||
|
||||
if (!(flags & NGX_HASH_WILDCARD_KEY)) {
|
||||
|
||||
@@ -863,14 +863,19 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
|
||||
* and ".example.com" to "com.example\0"
|
||||
*/
|
||||
|
||||
reverse = ngx_palloc(ha->temp_pool, key->len);
|
||||
if (reverse == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
len = 0;
|
||||
n = 0;
|
||||
|
||||
for (i = key->len - 1; i; i--) {
|
||||
if (key->data[i] == '.') {
|
||||
ngx_memcpy(&buf[n], &key->data[i + 1], len);
|
||||
ngx_memcpy(&reverse[n], &key->data[i + 1], len);
|
||||
n += len;
|
||||
buf[n++] = '.';
|
||||
reverse[n++] = '.';
|
||||
len = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -879,11 +884,22 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
|
||||
}
|
||||
|
||||
if (len) {
|
||||
ngx_memcpy(&buf[n], &key->data[1], len);
|
||||
ngx_memcpy(&reverse[n], &key->data[1], len);
|
||||
n += len;
|
||||
}
|
||||
|
||||
buf[n] = '\0';
|
||||
reverse[n] = '\0';
|
||||
|
||||
|
||||
hk = ngx_array_push(&ha->dns_wildcards);
|
||||
if (hk == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
hk->key.len = key->len - 1;
|
||||
hk->key.data = reverse;
|
||||
hk->key_hash = 0;
|
||||
hk->value = value;
|
||||
|
||||
|
||||
/* check conflicts in wildcard hash */
|
||||
@@ -922,20 +938,8 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
|
||||
if (name->data == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_memcpy(name->data, key->data + skip, name->len);
|
||||
|
||||
|
||||
ngx_memcpy(key->data, buf, key->len);
|
||||
key->len--;
|
||||
|
||||
hk = ngx_array_push(&ha->dns_wildcards);
|
||||
if (hk == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
hk->key = *key;
|
||||
hk->key_hash = 0;
|
||||
hk->value = value;
|
||||
}
|
||||
|
||||
return NGX_OK;
|
||||
|
||||
@@ -490,8 +490,17 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
|
||||
tp = NULL;
|
||||
|
||||
} else {
|
||||
|
||||
/*
|
||||
* 64-bit MacOSX kernel has the bug: kernel level ts.tv_nsec is
|
||||
* the int32_t while user level ts.tv_nsec is the long (64-bit),
|
||||
* so on the big endian PowerPC all nanoseconds are lost.
|
||||
* NGX_MACOSX_KEVENT_BUG_SHIFT on these machines is "<< 32".
|
||||
*/
|
||||
|
||||
ts.tv_sec = timer / 1000;
|
||||
ts.tv_nsec = (timer % 1000) * 1000000;
|
||||
ts.tv_nsec = (long) ((timer % 1000) * 1000000)
|
||||
NGX_MACOSX_KEVENT_BUG_SHIFT;
|
||||
tp = &ts;
|
||||
}
|
||||
|
||||
|
||||
@@ -1043,8 +1043,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
|
||||
/* there was error while a header line parsing */
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
ngx_http_upstream_header_errors[rc
|
||||
- NGX_HTTP_PARSE_HEADER_ERROR]);
|
||||
"upstream sent invalid header");
|
||||
|
||||
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
||||
|
||||
|
||||
@@ -800,9 +800,11 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"upstream sent no valid HTTP/1.0 header");
|
||||
|
||||
#if 0
|
||||
if (u->accel) {
|
||||
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
||||
}
|
||||
#endif
|
||||
|
||||
r->http_version = NGX_HTTP_VERSION_9;
|
||||
p->status = NGX_HTTP_OK;
|
||||
@@ -961,6 +963,10 @@ ngx_http_proxy_parse_status_line(ngx_http_request_t *r, ngx_http_proxy_ctx_t *p)
|
||||
|
||||
/* HTTP status code */
|
||||
case sw_status:
|
||||
if (ch == ' ') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch < '0' || ch > '9') {
|
||||
return NGX_HTTP_PROXY_PARSE_NO_HEADER;
|
||||
}
|
||||
@@ -1111,8 +1117,7 @@ ngx_http_proxy_process_header(ngx_http_request_t *r)
|
||||
/* there was error while a header line parsing */
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
ngx_http_upstream_header_errors[rc
|
||||
- NGX_HTTP_PARSE_HEADER_ERROR]);
|
||||
"upstream sent invalid header");
|
||||
|
||||
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ WriteMakefile(
|
||||
AUTHOR => 'Igor Sysoev',
|
||||
|
||||
CCFLAGS => "$ENV{NGX_PERL_CFLAGS}",
|
||||
OPTIMIZE => '-O',
|
||||
|
||||
INC => "-I ../../../../../src/core " .
|
||||
"-I ../../../../../src/event " .
|
||||
|
||||
@@ -632,7 +632,7 @@ ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
|
||||
"call_sv: %d", status);
|
||||
|
||||
} else {
|
||||
line = POPpx;
|
||||
line = SvPVx(POPs, n_a);
|
||||
rv->len = n_a;
|
||||
|
||||
rv->data = ngx_palloc(r->pool, n_a);
|
||||
|
||||
@@ -563,6 +563,8 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
virtual_names:
|
||||
|
||||
ngx_memzero(&ha, sizeof(ngx_hash_keys_arrays_t));
|
||||
|
||||
ha.temp_pool = ngx_create_pool(16384, cf->log);
|
||||
if (ha.temp_pool == NULL) {
|
||||
return NGX_CONF_ERROR;
|
||||
@@ -578,6 +580,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
name = in_addr[a].names.elts;
|
||||
for (s = 0; s < in_addr[a].names.nelts; s++) {
|
||||
|
||||
ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
||||
"server name \"%V\"", &name[s].name);
|
||||
|
||||
ch = name[s].name.data[0];
|
||||
|
||||
if (ch == '*' || ch == '.') {
|
||||
@@ -600,6 +605,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
for (s = 0; s < in_addr[a].names.nelts; s++) {
|
||||
|
||||
ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
||||
"wildcard server name \"%V\"", &name[s].name);
|
||||
|
||||
ch = name[s].name.data[0];
|
||||
|
||||
if (ch != '*' && ch != '.') {
|
||||
|
||||
@@ -2243,6 +2243,10 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
ls->conf.rcvbuf = -1;
|
||||
ls->conf.sndbuf = -1;
|
||||
|
||||
if (inet_upstream.host.len == 1 && inet_upstream.host.data[0] == '*') {
|
||||
inet_upstream.host.len = 0;
|
||||
}
|
||||
|
||||
if (inet_upstream.host.len) {
|
||||
inet_upstream.host.data[inet_upstream.host.len] = '\0';
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#define NGX_HTTP_PARSE_INVALID_REQUEST 11
|
||||
#define NGX_HTTP_PARSE_INVALID_09_METHOD 12
|
||||
|
||||
#define NGX_HTTP_PARSE_HEADER_ERROR 13
|
||||
#define NGX_HTTP_PARSE_INVALID_HEADER 13
|
||||
|
||||
#define NGX_HTTP_ZERO_IN_URI 1
|
||||
|
||||
@@ -259,12 +259,6 @@ static ngx_http_variable_t ngx_http_upstream_vars[] = {
|
||||
};
|
||||
|
||||
|
||||
char *ngx_http_upstream_header_errors[] = {
|
||||
"upstream sent invalid header",
|
||||
"upstream sent too long header line"
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
ngx_http_upstream_init(ngx_http_request_t *r)
|
||||
{
|
||||
@@ -624,6 +618,7 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
c->sendfile = 0;
|
||||
u->output.sendfile = 0;
|
||||
|
||||
peer = &u->peer.peers->peer[u->peer.cur_peer];
|
||||
|
||||
|
||||
@@ -199,7 +199,5 @@ void ngx_http_upstream_init(ngx_http_request_t *r);
|
||||
|
||||
extern ngx_module_t ngx_http_upstream_module;
|
||||
|
||||
extern char *ngx_http_upstream_header_errors[];
|
||||
|
||||
|
||||
#endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */
|
||||
|
||||
@@ -442,6 +442,10 @@ ngx_imap_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
if (inet_upstream.host.len == 1 && inet_upstream.host.data[0] == '*') {
|
||||
inet_upstream.host.len = 0;
|
||||
}
|
||||
|
||||
if (inet_upstream.host.len) {
|
||||
inet_upstream.host.data[inet_upstream.host.len] = '\0';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user