nginx-0.0.1-2003-10-24-10:53:41 import
diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c
index a4e0afa..9e42b44 100644
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -50,12 +50,19 @@
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
-static char *ngx_http_gzip_set_window(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
+static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data);
+static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data);
-static ngx_conf_bounds_t ngx_http_gzip_comp_level_bounds;
+
+static ngx_conf_num_bounds_t ngx_http_gzip_comp_level_bounds = {
+ ngx_conf_check_num_bounds, 1, 9
+};
+
+static ngx_conf_post_handler_pt ngx_http_gzip_set_window_p =
+ ngx_http_gzip_set_window;
+static ngx_conf_post_handler_pt ngx_http_gzip_set_hash_p =
+ ngx_http_gzip_set_hash;
+
static ngx_command_t ngx_http_gzip_filter_commands[] = {
@@ -83,17 +90,17 @@
{ngx_string("gzip_window"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_gzip_set_window,
+ ngx_conf_set_size_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_gzip_conf_t, wbits),
- NULL},
+ &ngx_http_gzip_set_window_p},
{ngx_string("gzip_hash"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_gzip_set_hash,
+ ngx_conf_set_size_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_gzip_conf_t, memlevel),
- NULL},
+ &ngx_http_gzip_set_hash_p},
{ngx_string("gzip_no_buffer"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
@@ -128,12 +135,7 @@
};
-static ngx_conf_bounds_t ngx_http_gzip_comp_level_bounds = {
- ngx_conf_check_num_bounds, { { 1, 9 } }
-};
-
-
-static u_char gzheader[10] = { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 };
+static u_char gzheader[10] = { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 };
#if (HAVE_LITTLE_ENDIAN)
@@ -240,8 +242,8 @@
/*
* We preallocate a memory for zlib in one hunk (200K-400K), this
- * dicreases number of malloc() and free() calls and probably
- * syscalls.
+ * dicreases a number of malloc() and free() calls and also probably
+ * dicreases a number of syscalls.
* Besides we free() this memory as soon as the gzipping will complete
* and do not wait while a whole response will be sent to a client.
*
@@ -591,28 +593,21 @@
}
-static char *ngx_http_gzip_set_window(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
+static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data)
{
- ngx_http_gzip_conf_t *lcf = conf;
+ int *np = data;
- int wbits, wsize;
- char *rv;
+ int wbits, wsize;
- rv = ngx_conf_set_size_slot(cf, cmd, conf);
- if (rv) {
- return rv;
- }
-
-ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "WBITS: %d", lcf->wbits);
+ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "WBITS: %d", *np);
wbits = 15;
for (wsize = 32 * 1024; wsize > 256; wsize >>= 1) {
- if (wsize == lcf->wbits) {
- lcf->wbits = wbits;
-ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "WBITS: %d", lcf->wbits);
+ if (wsize == *np) {
+ *np = wbits;
+ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "WBITS: %d", *np);
return NULL;
}
@@ -623,28 +618,21 @@
}
-static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
+static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data)
{
- ngx_http_gzip_conf_t *lcf = conf;
+ int *np = data;
- int memlevel, hsize;
- char *rv;
+ int memlevel, hsize;
- rv = ngx_conf_set_size_slot(cf, cmd, conf);
- if (rv) {
- return rv;
- }
-
-ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "MEMLEVEL: %d", lcf->memlevel);
+ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "MEMLEVEL: %d", *np);
memlevel = 9;
for (hsize = 128 * 1024; hsize > 256; hsize >>= 1) {
- if (hsize == lcf->memlevel) {
- lcf->memlevel = memlevel;
-ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "MEMLEVEL: %d", lcf->memlevel);
+ if (hsize == *np) {
+ *np = memlevel;
+ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "MEMLEVEL: %d", *np);
return NULL;
}
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index 888c912..628eeec 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -188,8 +188,6 @@
/* STUB */ p->accel = 1;
- p->host_header = p->upstream.peers->peers[0].host;
-
ngx_test_null(p->request_hunks, ngx_http_proxy_create_request(p),
NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -220,7 +218,7 @@
+ r->uri.len - p->location_len
+ 1 + r->args.len /* 1 is for "?" */
+ sizeof(http_version) - 1
- + sizeof(host_header) - 1 + p->host_header.len + 2
+ + sizeof(host_header) - 1 + p->lcf->upstream->host_header.len + 2
/* 2 is for "\r\n" */
+ sizeof(connection_close_header) - 1
+ 2; /* 2 is for "\r\n" at the header end */
@@ -268,7 +266,8 @@
/* the "Host" header */
h->last = ngx_cpymem(h->last, host_header, sizeof(host_header) - 1);
- h->last = ngx_cpymem(h->last, p->host_header.data, p->host_header.len);
+ h->last = ngx_cpymem(h->last, p->lcf->upstream->host_header.data,
+ p->lcf->upstream->host_header.len);
*(h->last++) = CR; *(h->last++) = LF;
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h
index dedb06a..ea33083 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.h
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.h
@@ -73,7 +73,6 @@
int method;
ngx_str_t uri;
int location_len;
- ngx_str_t host_header;
ngx_event_pipe_t *event_pipe;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 8c96d0e..ad557e4 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -165,6 +165,13 @@
offsetof(ngx_http_core_loc_conf_t, lingering_timeout),
NULL},
+ {ngx_string("msie_padding"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_core_loc_conf_t, msie_padding),
+ NULL},
+
{ngx_string("error_log"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_set_error_log,
@@ -843,6 +850,8 @@
lcf->lingering_time = NGX_CONF_UNSET;
lcf->lingering_timeout = NGX_CONF_UNSET;
+ lcf->msie_padding = NGX_CONF_UNSET;
+
return lcf;
}
@@ -916,6 +925,8 @@
ngx_conf_merge_msec_value(conf->lingering_timeout,
prev->lingering_timeout, 5000);
+ ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1);
+
return NGX_CONF_OK;
}
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 9cc9791..7ffebb4 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -118,6 +118,8 @@
ngx_msec_t lingering_time; /* lingering_time */
ngx_msec_t lingering_timeout; /* lingering_timeout */
+ int msie_padding; /* msie_padding */
+
ngx_log_t *err_log;
} ngx_http_core_loc_conf_t;
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 2b274d5..ce6183e 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -152,9 +152,10 @@
int ngx_http_special_response_handler(ngx_http_request_t *r, int error)
{
- int err, rc;
- ngx_hunk_t *h;
- ngx_chain_t *out, **ll, *cl;
+ int err, rc;
+ ngx_hunk_t *h;
+ ngx_chain_t *out, **ll, *cl;
+ ngx_http_core_loc_conf_t *clcf;
r->headers_out.status = error;
@@ -238,7 +239,9 @@
ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR);
ngx_chain_add_link(out, ll, cl);
- if (/* STUB: "msie_padding on/off" */ 1
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (clcf->msie_padding
&& r->http_version >= NGX_HTTP_VERSION_10
&& error >= NGX_HTTP_BAD_REQUEST
&& error != NGX_HTTP_REQUEST_URI_TOO_LARGE