nginx-0.1.42-RELEASE import
*) Bugfix: if the request URI had a zero length after the processing in
the ngx_http_proxy_module, then the segmentation fault or bus error
occurred in the ngx_http_proxy_module.
*) Bugfix: the "limit_rate" directive did not work inside the "if"
block; the bug had appeared in 0.1.38.
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 0dbd652..9ba8ffa 100644
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -9,6 +9,35 @@
<title lang="en">nginx changelog</title>
+<changes ver="0.1.42" date="23.08.2005">
+
+<change type="bugfix">
+<para lang="ru">
+ÅÓÌÉ URI ÚÁÐÒÏÓÁ ÐÏÌÕÞÁÌÓÑ ÎÕÌÅ×ÏÊ ÄÌÉÎÙ ÐÏÓÌÅ ÏÂÒÁÂÏÔËÉ ÍÏÄÕÌÅÍ
+ngx_http_rewrite_module, ÔÏ × ÍÏÄÕÌÅ ngx_http_proxy_module ÐÒÏÉÓÈÏÄÉÌ
+segmentation fault ÉÌÉ bus error.
+</para>
+<para lang="en">
+if the request URI had a zero length after the processing in
+the ngx_http_proxy_module, then the segmentation fault or bus error occurred
+in the ngx_http_proxy_module.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÄÉÒÅËÔÉ×Á limit_rate ÎÅ ÒÁÂÏÔÁÌÁ ×ÎÕÔÒÉ ÂÌÏËÁ if;
+ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.38.
+</para>
+<para lang="en">
+the "limit_rate" directive did not work inside the "if" block;
+bug appeared in 0.1.38.
+</para>
+</change>
+
+</changes>
+
+
<changes ver="0.1.41" date="25.07.2005">
<change type="bugfix">
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 281036f..8f0a365 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.1.41"
+#define NGINX_VER "nginx/0.1.42"
#define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin"
diff --git a/src/event/ngx_event_timer.c b/src/event/ngx_event_timer.c
index 53bbc5f..4d6c647 100644
--- a/src/event/ngx_event_timer.c
+++ b/src/event/ngx_event_timer.c
@@ -67,7 +67,7 @@
(node->key * NGX_TIMER_RESOLUTION - ngx_elapsed_msec);
#endif
- return timer > 0 ? timer: 0 ;
+ return timer > 0 ? timer : 0 ;
}
diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h
index 2a62896..5be3936 100644
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -67,6 +67,7 @@
ngx_str_t *name, ngx_str_t *value);
ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
+void ngx_http_update_location_config(ngx_http_request_t *r);
void ngx_http_handler(ngx_http_request_t *r);
void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index cb7c9e8..852a9bb 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -586,27 +586,7 @@
return NGX_HTTP_NOT_FOUND;
}
- r->connection->log->file = clcf->err_log->file;
- if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
- r->connection->log->log_level = clcf->err_log->log_level;
- }
-
- if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
- r->connection->sendfile = 1;
-
- } else {
- r->connection->sendfile = 0;
- }
-
- if (r->keepalive && clcf->keepalive_timeout == 0) {
- r->keepalive = 0;
- }
-
- if (!clcf->tcp_nopush) {
- /* disable TCP_NOPUSH/TCP_CORK use */
- r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
- }
-
+ ngx_http_update_location_config(r);
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http cl:%z max:%uz",
@@ -640,13 +620,43 @@
return NGX_HTTP_MOVED_PERMANENTLY;
}
+ return NGX_OK;
+}
+
+
+void
+ngx_http_update_location_config(ngx_http_request_t *r)
+{
+ ngx_http_core_loc_conf_t *clcf;
+
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ r->connection->log->file = clcf->err_log->file;
+ if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
+ r->connection->log->log_level = clcf->err_log->log_level;
+ }
+
+ if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
+ r->connection->sendfile = 1;
+
+ } else {
+ r->connection->sendfile = 0;
+ }
+
+ if (r->keepalive && clcf->keepalive_timeout == 0) {
+ r->keepalive = 0;
+ }
+
+ if (!clcf->tcp_nopush) {
+ /* disable TCP_NOPUSH/TCP_CORK use */
+ r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
+ }
+
r->limit_rate = clcf->limit_rate;
if (clcf->handler) {
r->content_handler = clcf->handler;
}
-
- return NGX_OK;
}
@@ -1072,6 +1082,8 @@
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
r->loc_conf = cscf->ctx->loc_conf;
+ ngx_http_update_location_config(r);
+
r->internal = 1;
ngx_http_handler(r);
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 6c8bf2f..c6a5809 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1696,9 +1696,6 @@
ngx_http_postponed_handler(ngx_http_request_t *r)
{
ngx_int_t rc;
-#if 0
- ngx_http_request_t *mr;
-#endif
ngx_http_postponed_request_t *pr;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index d1ba774..2e80991 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -241,9 +241,9 @@
typedef struct ngx_http_postponed_request_s ngx_http_postponed_request_t;
struct ngx_http_postponed_request_s {
- ngx_http_request_t *request;
- ngx_chain_t *out;
- ngx_http_postponed_request_t *next;
+ ngx_http_request_t *request;
+ ngx_chain_t *out;
+ ngx_http_postponed_request_t *next;
};
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
index 716a6f0..27c9ce0 100644
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -687,6 +687,14 @@
if (code->uri) {
r->uri = e->buf;
+ if (r->uri.len == 0) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "the rewritten URI has a zero length");
+ e->ip = ngx_http_script_exit;
+ e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ return;
+ }
+
if (ngx_http_set_exten(r) != NGX_OK) {
e->ip = ngx_http_script_exit;
e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -737,6 +745,7 @@
if (e->sp->value) {
if (code->loc_conf) {
e->request->loc_conf = code->loc_conf;
+ ngx_http_update_location_config(e->request);
}
e->ip += sizeof(ngx_http_script_if_code_t);
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 14d4c80..ba3bfcb 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -161,7 +161,7 @@
"<html>" CRLF
"<head><title>501 Method Not Implemented</title></head>" CRLF
"<body bgcolor=\"white\">" CRLF
-"<center><h1>500 Method Not Implemented</h1></center>" CRLF
+"<center><h1>501 Method Not Implemented</h1></center>" CRLF
;
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 9d05694..0c8fdd2 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -916,7 +916,7 @@
#endif
if (ngx_add_channel_event(cycle, ngx_channel, NGX_READ_EVENT,
- ngx_channel_handler) == NGX_ERROR)
+ ngx_channel_handler) == NGX_ERROR)
{
/* fatal */
exit(2);