aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_gzip_filter.c5
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_handler.c32
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_handler.h3
3 files changed, 30 insertions, 10 deletions
diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c
index df360b80b..5b8cebb4b 100644
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -287,6 +287,8 @@ static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
ngx_create_temp_hunk(r->pool, conf->bufs.size,
0, 0),
ngx_http_gzip_error(ctx));
+ ctx->out_hunk->tag = (ngx_hunk_tag_t)
+ &ngx_http_gzip_filter_module;
ctx->out_hunk->type |= NGX_HUNK_RECYCLED;
ctx->hunks++;
@@ -417,7 +419,8 @@ ngx_log_debug(r->connection->log, "DEFLATE(): %08x %08x %d %d %d" _
return ngx_http_gzip_error(ctx);
}
- ngx_chain_update_chains(&ctx->free, &ctx->busy, &ctx->out);
+ ngx_chain_update_chains(&ctx->free, &ctx->busy, &ctx->out,
+ (ngx_hunk_tag_t) &ngx_http_gzip_filter_module);
ctx->last_out = &ctx->out;
}
}
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index eefa1f886..e3157d8e6 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -410,6 +410,7 @@ static void ngx_http_proxy_process_upstream_status_line(ngx_event_t *rev)
ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
+ p->header_in->tag = (ngx_hunk_tag_t) &ngx_http_proxy_module;
}
n = ngx_http_proxy_read_upstream_header(p);
@@ -712,6 +713,7 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p)
ep->output_filter = (ngx_event_pipe_output_filter_pt)
ngx_http_output_filter;
ep->output_ctx = r;
+ ep->tag = (ngx_hunk_tag_t) &ngx_http_proxy_module;
ep->bufs = p->lcf->bufs;
ep->max_busy_len = p->lcf->max_busy_len;
ep->upstream = p->upstream.connection;
@@ -720,7 +722,7 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p)
ep->log = r->connection->log;
ep->temp_path = p->lcf->temp_path;
- ep->temp_file = ngx_palloc(r->pool, sizeof(ngx_file_t));
+ ep->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
if (ep->temp_file == NULL) {
ngx_http_proxy_finalize_request(p, 0);
return;
@@ -750,10 +752,23 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p)
*/
p->header_in->last = p->header_in->pos;
- /* STUB */ ep->cachable = 1;
-#if 0
- ep->max_temp_file_size = 1000000000;
-#endif
+ /* STUB */ ep->cachable = 0;
+
+ if (p->lcf->cyclic_temp_file) {
+
+ /*
+ * we need to disable the use of sendfile() if we use cyclic temp file
+ * because the writing a new data can interfere with sendfile
+ * that uses the same kernel file pages
+ */
+
+ ep->cyclic_temp_file = 1;
+ r->sendfile = 0;
+
+ } else {
+ ep->cyclic_temp_file = 0;
+ r->sendfile = 1;
+ }
p->event_pipe = ep;
@@ -1162,16 +1177,17 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
conf->header_size = 4096;
conf->read_timeout = 30000;
- conf->bufs.num = 10;
+ conf->bufs.num = 5;
conf->bufs.size = 4096;
conf->max_busy_len = 8192;
/* CHECK in _init conf->max_temp_size >= conf->bufs.size !!! */
- conf->max_temp_file_size = 4096 * 6;
+ conf->max_temp_file_size = 4096 * 3;
- conf->temp_file_write_size = 4096 * 1;
+ conf->temp_file_write_size = 4096 * 2;
+ conf->cyclic_temp_file= 1;
ngx_test_null(conf->temp_path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)),
NULL);
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h
index fe6ca23b7..597c309ff 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.h
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.h
@@ -26,10 +26,11 @@ typedef struct {
ngx_bufs_t bufs;
- /* STUB */
+ /* STUB names */
int max_busy_len;
int max_temp_file_size;
int temp_file_write_size;
+ int cyclic_temp_file;
/* */
ngx_path_t *temp_path;