nginx-0.1.33-RELEASE import
*) Bugfix: nginx could not be built with the --without-pcre parameter;
the bug had appeared in 0.1.29.
*) Bugfix: 3, 4, 7, and 8 the "proxy_set_header" directives in one
level cause the bus fault on start up.
*) Bugfix: the HTTP protocol was specified in the HTTPS redirects.
*) Bugfix: if the "rewrite" directive used the captures inside the "if"
directive, then the 500 error code was returned.
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index a24be24..92dd6cc 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -311,8 +311,8 @@
static ngx_table_elt_t ngx_http_proxy_headers[] = {
- { 0, ngx_string("Host"), ngx_string("$proxy_host"), },
- { 0, ngx_string("Connection"), ngx_string("close"), },
+ { 0, ngx_string("Host"), ngx_string("$proxy_host") },
+ { 0, ngx_string("Connection"), ngx_string("close") },
{ 0, ngx_null_string, ngx_null_string }
};
@@ -1560,6 +1560,8 @@
*s = *h;
+ src = conf->headers_source->elts;
+
next:
continue;
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c
index 47ff8c5..da4719b 100644
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -556,8 +556,7 @@
regex_end->redirect = regex->redirect;
if (last) {
- code = ngx_http_script_add_code(lcf->codes, sizeof(uintptr_t),
- ®ex);
+ code = ngx_http_script_add_code(lcf->codes, sizeof(uintptr_t), ®ex);
if (code == NULL) {
return NGX_CONF_ERROR;
}
@@ -713,6 +712,11 @@
}
+ if (lcf->captures < nlcf->captures) {
+ lcf->captures = nlcf->captures;
+ }
+
+
if (elts != lcf->codes->elts) {
if_code = (ngx_http_script_if_code_t *)
((u_char *) if_code + ((u_char *) lcf->codes->elts - elts));
diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c
index f3defa0..a45f2e5 100644
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -264,11 +264,26 @@
{
r->headers_out.location->hash = 0;
- len += sizeof("Location: http://") - 1
- + r->server_name.len + r->headers_out.location->value.len + 2;
+#if (NGX_HTTP_SSL)
+ if (r->connection->ssl) {
+ len += sizeof("Location: https://") - 1
+ + r->server_name.len
+ + r->headers_out.location->value.len + 2;
- if (r->port != 80) {
- len += r->port_text->len;
+ if (r->port != 443) {
+ len += r->port_text->len;
+ }
+
+ } else
+#endif
+ {
+ len += sizeof("Location: http://") - 1
+ + r->server_name.len
+ + r->headers_out.location->value.len + 2;
+
+ if (r->port != 80) {
+ len += r->port_text->len;
+ }
}
}
@@ -396,13 +411,33 @@
&& r->headers_out.location->value.data[0] == '/')
{
p = b->last + sizeof("Location: ") - 1;
- b->last = ngx_cpymem(b->last, "Location: http://",
- sizeof("Location: http://") - 1);
+
+ b->last = ngx_cpymem(b->last, "Location: http",
+ sizeof("Location: http") - 1);
+
+#if (NGX_HTTP_SSL)
+ if (r->connection->ssl) {
+ *b->last++ ='s';
+ }
+#endif
+
+ *b->last++ = ':'; *b->last++ = '/'; *b->last++ = '/';
b->last = ngx_cpymem(b->last, r->server_name.data,
r->server_name.len);
- if (r->port != 80) {
- b->last = ngx_cpymem(b->last, r->port_text->data,
- r->port_text->len);
+
+#if (NGX_HTTP_SSL)
+ if (r->connection->ssl) {
+ if (r->port != 443) {
+ b->last = ngx_cpymem(b->last, r->port_text->data,
+ r->port_text->len);
+ }
+ } else
+#endif
+ {
+ if (r->port != 80) {
+ b->last = ngx_cpymem(b->last, r->port_text->data,
+ r->port_text->len);
+ }
}
b->last = ngx_cpymem(b->last, r->headers_out.location->value.data,
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
index ea1e56b..89256b3 100644
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -463,6 +463,9 @@
}
+
+#if (NGX_PCRE)
+
void
ngx_http_script_regex_start_code(ngx_http_script_engine_t *e)
{
@@ -693,6 +696,8 @@
e->ip += sizeof(ngx_http_script_regex_end_code_t);
}
+#endif
+
void
ngx_http_script_return_code(ngx_http_script_engine_t *e)
diff --git a/src/http/ngx_http_script.h b/src/http/ngx_http_script.h
index cf80f22..eb6f17e 100644
--- a/src/http/ngx_http_script.h
+++ b/src/http/ngx_http_script.h
@@ -79,6 +79,8 @@
} ngx_http_script_copy_capture_code_t;
+#if (NGX_PCRE)
+
typedef struct {
ngx_http_script_code_pt code;
ngx_regex_t *regex;
@@ -114,6 +116,8 @@
uintptr_t redirect:1;
} ngx_http_script_regex_end_code_t;
+#endif
+
typedef struct {
ngx_http_script_code_pt code;
@@ -156,10 +160,11 @@
void ngx_http_script_copy_var_code(ngx_http_script_engine_t *e);
size_t ngx_http_script_copy_capture_len_code(ngx_http_script_engine_t *e);
void ngx_http_script_copy_capture_code(ngx_http_script_engine_t *e);
+void ngx_http_script_start_args_code(ngx_http_script_engine_t *e);
+#if (NGX_PCRE)
void ngx_http_script_regex_start_code(ngx_http_script_engine_t *e);
void ngx_http_script_regex_end_code(ngx_http_script_engine_t *e);
-void ngx_http_script_copy_capture_code(ngx_http_script_engine_t *e);
-void ngx_http_script_start_args_code(ngx_http_script_engine_t *e);
+#endif
void ngx_http_script_return_code(ngx_http_script_engine_t *e);
void ngx_http_script_if_code(ngx_http_script_engine_t *e);
void ngx_http_script_complex_value_code(ngx_http_script_engine_t *e);