diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-04-01 16:20:53 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-04-01 16:20:53 +0000 |
commit | dbb27765706e2d2f35b0af57c317b58d2d9d6ec9 (patch) | |
tree | 69760523cc77e8244f0f1d5c3c0247544a1179b9 /src/http | |
parent | 205dc145c5d22613826927d6ae8ccd3a69d0e907 (diff) | |
download | nginx-dbb27765706e2d2f35b0af57c317b58d2d9d6ec9.tar.gz nginx-dbb27765706e2d2f35b0af57c317b58d2d9d6ec9.zip |
nginx-0.0.3-2004-04-01-20:20:53 import
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 10 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.h | 1 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_upstream.c | 6 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.c | 10 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.h | 1 | ||||
-rw-r--r-- | src/http/ngx_http_request.h | 1 | ||||
-rw-r--r-- | src/http/ngx_http_request_body.c | 15 | ||||
-rw-r--r-- | src/http/ngx_http_write_filter.c | 5 |
8 files changed, 27 insertions, 22 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index 8f0336a9b..0dba23f9b 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -60,13 +60,6 @@ static ngx_command_t ngx_http_proxy_commands[] = { 0, NULL }, - { ngx_string("proxy_request_buffer_size"), - NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_conf_set_size_slot, - NGX_HTTP_LOC_CONF_OFFSET, - offsetof(ngx_http_proxy_loc_conf_t, request_buffer_size), - NULL }, - { ngx_string("proxy_connect_timeout"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_msec_slot, @@ -781,7 +774,6 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) */ - conf->request_buffer_size = NGX_CONF_UNSET_SIZE; conf->connect_timeout = NGX_CONF_UNSET_MSEC; conf->send_timeout = NGX_CONF_UNSET_MSEC; @@ -822,8 +814,6 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *prev = parent; ngx_http_proxy_loc_conf_t *conf = child; - ngx_conf_merge_size_value(conf->request_buffer_size, - prev->request_buffer_size, 8192); ngx_conf_merge_msec_value(conf->connect_timeout, prev->connect_timeout, 60000); ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 30000); diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h index d204cac59..853aa7617 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.h +++ b/src/http/modules/proxy/ngx_http_proxy_handler.h @@ -48,7 +48,6 @@ typedef struct { typedef struct { - size_t request_buffer_size; size_t header_buffer_size; size_t busy_buffers_size; size_t max_temp_file_size; diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c index 00a078009..bd4befd76 100644 --- a/src/http/modules/proxy/ngx_http_proxy_upstream.c +++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c @@ -86,7 +86,6 @@ int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p) tf->warn = "a client request body is buffered to a temporary file"; /* tf->persistent = 0; */ - rb->buf_size = p->lcf->request_buffer_size; rb->handler = ngx_http_proxy_init_upstream; rb->data = p; /* rb->bufs = NULL; */ @@ -1179,7 +1178,10 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p) ep->temp_file->file.log = r->connection->log; ep->temp_file->path = p->lcf->temp_path; ep->temp_file->pool = r->pool; - if (!p->cachable) { + + if (p->cachable) { + ep->temp_file->persistent = 1; + } else { ep->temp_file->warn = "an upstream response is buffered " "to a temporary file"; } diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 1f449e239..3ae61829f 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -149,6 +149,13 @@ static ngx_command_t ngx_http_core_commands[] = { offsetof(ngx_http_core_loc_conf_t, client_max_body_size), NULL }, + { ngx_string("client_body_buffer_size"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_size_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_core_loc_conf_t, client_body_buffer_size), + NULL }, + { ngx_string("client_body_timeout"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_msec_slot, @@ -1181,6 +1188,7 @@ static void *ngx_http_core_create_loc_conf(ngx_conf_t *cf) */ lcf->client_max_body_size = NGX_CONF_UNSET_SIZE; + lcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; lcf->client_body_timeout = NGX_CONF_UNSET_MSEC; lcf->sendfile = NGX_CONF_UNSET; lcf->tcp_nopush = NGX_CONF_UNSET; @@ -1261,6 +1269,8 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf, ngx_conf_merge_size_value(conf->client_max_body_size, prev->client_max_body_size, 10 * 1024 * 1024); + ngx_conf_merge_size_value(conf->client_body_buffer_size, + prev->client_body_buffer_size, 8192); ngx_conf_merge_msec_value(conf->client_body_timeout, prev->client_body_timeout, 60000); ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index 3af3ed480..130106bae 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -124,6 +124,7 @@ typedef struct { size_t client_max_body_size; /* client_max_body_size */ size_t send_lowat; /* send_lowat */ size_t discarded_buffer_size; /* discarded_buffer_size */ + size_t client_body_buffer_size; /* client_body_buffer_size */ ngx_msec_t client_body_timeout; /* client_body_timeout */ ngx_msec_t send_timeout; /* send_timeout */ diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index a3161531f..5e127e8fc 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -155,7 +155,6 @@ typedef struct { ngx_chain_t *bufs; ngx_hunk_t *buf; size_t rest; - size_t buf_size; void (*handler) (void *data); void *data; } ngx_http_request_body_t; diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c index 9f1260c6f..c4aada505 100644 --- a/src/http/ngx_http_request_body.c +++ b/src/http/ngx_http_request_body.c @@ -11,10 +11,10 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r); ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r) { - ssize_t size; - ngx_hunk_t *h; - ngx_chain_t *cl; - + ssize_t size; + ngx_hunk_t *h; + ngx_chain_t *cl; + ngx_http_core_loc_conf_t *clcf; size = r->header_in->last - r->header_in->pos; @@ -47,15 +47,18 @@ ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r) } + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + r->request_body->rest = r->headers_in.content_length_n - size; if (r->request_body->rest - < r->request_body->buf_size + (r->request_body->buf_size >> 2)) + < clcf->client_body_buffer_size + + (clcf->client_body_buffer_size >> 2)) { size = r->request_body->rest; } else { - size = r->request_body->buf_size; + size = clcf->client_body_buffer_size; } ngx_test_null(r->request_body->buf, ngx_create_temp_hunk(r->pool, size), diff --git a/src/http/ngx_http_write_filter.c b/src/http/ngx_http_write_filter.c index 1091d75be..5fa144fbc 100644 --- a/src/http/ngx_http_write_filter.c +++ b/src/http/ngx_http_write_filter.c @@ -62,7 +62,7 @@ ngx_module_t ngx_http_write_filter_module = { ngx_http_write_filter_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ ngx_http_write_filter_init, /* init module */ - NULL /* init child */ + NULL /* init process */ }; @@ -82,7 +82,8 @@ int ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) sizeof(ngx_http_write_filter_ctx_t), NGX_ERROR); } - size = flush = 0; + size = 0; + flush = 0; last = 0; ll = &ctx->out; |