mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
nginx-0.0.12-2004-09-26-23:01:48 import
This commit is contained in:
parent
c3e4746be2
commit
4bed6e3120
@ -873,9 +873,9 @@ static ngx_int_t ngx_http_core_init_process(ngx_cycle_t *cycle)
|
|||||||
|
|
||||||
ngx_http_handler_pt *h;
|
ngx_http_handler_pt *h;
|
||||||
|
|
||||||
if (!(h = ngx_array_push(&cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers)))
|
ngx_test_null(h, ngx_push_array(
|
||||||
return NGX_ERROR;
|
&cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers),
|
||||||
}
|
NGX_ERROR);
|
||||||
*h = ngx_http_delay_handler;
|
*h = ngx_http_delay_handler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -904,26 +904,24 @@ static char *ngx_server_block(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
|
|||||||
ngx_http_core_main_conf_t *cmcf;
|
ngx_http_core_main_conf_t *cmcf;
|
||||||
ngx_http_core_srv_conf_t *cscf, **cscfp;
|
ngx_http_core_srv_conf_t *cscf, **cscfp;
|
||||||
|
|
||||||
if (!(ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)))) {
|
ngx_test_null(ctx,
|
||||||
return NGX_CONF_ERROR;
|
ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
|
||||||
}
|
NGX_CONF_ERROR);
|
||||||
|
|
||||||
http_ctx = cf->ctx;
|
http_ctx = cf->ctx;
|
||||||
ctx->main_conf = http_ctx->main_conf;
|
ctx->main_conf = http_ctx->main_conf;
|
||||||
|
|
||||||
/* the server{}'s srv_conf */
|
/* the server{}'s srv_conf */
|
||||||
|
|
||||||
ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
|
ngx_test_null(ctx->srv_conf,
|
||||||
if (ctx->srv_conf == NULL) {
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
|
||||||
return NGX_CONF_ERROR;
|
NGX_CONF_ERROR);
|
||||||
}
|
|
||||||
|
|
||||||
/* the server{}'s loc_conf */
|
/* the server{}'s loc_conf */
|
||||||
|
|
||||||
ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
|
ngx_test_null(ctx->loc_conf,
|
||||||
if (ctx->loc_conf == NULL) {
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
|
||||||
return NGX_CONF_ERROR;
|
NGX_CONF_ERROR);
|
||||||
}
|
|
||||||
|
|
||||||
for (m = 0; ngx_modules[m]; m++) {
|
for (m = 0; ngx_modules[m]; m++) {
|
||||||
if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
|
||||||
@ -1327,11 +1325,11 @@ static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngx_conf_merge_size_value(conf->connection_pool_size,
|
ngx_conf_merge_size_value(conf->connection_pool_size,
|
||||||
prev->connection_pool_size, 256);
|
prev->connection_pool_size, 2048);
|
||||||
ngx_conf_merge_msec_value(conf->post_accept_timeout,
|
ngx_conf_merge_msec_value(conf->post_accept_timeout,
|
||||||
prev->post_accept_timeout, 60000);
|
prev->post_accept_timeout, 30000);
|
||||||
ngx_conf_merge_size_value(conf->request_pool_size,
|
ngx_conf_merge_size_value(conf->request_pool_size,
|
||||||
prev->request_pool_size, (size_t) ngx_pagesize);
|
prev->request_pool_size, 16384);
|
||||||
ngx_conf_merge_msec_value(conf->client_header_timeout,
|
ngx_conf_merge_msec_value(conf->client_header_timeout,
|
||||||
prev->client_header_timeout, 60000);
|
prev->client_header_timeout, 60000);
|
||||||
ngx_conf_merge_size_value(conf->client_header_buffer_size,
|
ngx_conf_merge_size_value(conf->client_header_buffer_size,
|
||||||
@ -1464,8 +1462,7 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
|
|||||||
ngx_conf_merge_size_value(conf->client_max_body_size,
|
ngx_conf_merge_size_value(conf->client_max_body_size,
|
||||||
prev->client_max_body_size, 10 * 1024 * 1024);
|
prev->client_max_body_size, 10 * 1024 * 1024);
|
||||||
ngx_conf_merge_size_value(conf->client_body_buffer_size,
|
ngx_conf_merge_size_value(conf->client_body_buffer_size,
|
||||||
prev->client_body_buffer_size,
|
prev->client_body_buffer_size, 8192);
|
||||||
(size_t) 4 * ngx_pagesize);
|
|
||||||
ngx_conf_merge_msec_value(conf->client_body_timeout,
|
ngx_conf_merge_msec_value(conf->client_body_timeout,
|
||||||
prev->client_body_timeout, 60000);
|
prev->client_body_timeout, 60000);
|
||||||
ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
|
ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
|
||||||
|
@ -246,7 +246,9 @@ static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
|
|||||||
* Konqueror keeps the connection alive for about N seconds.
|
* Konqueror keeps the connection alive for about N seconds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (clcf->keepalive_header) {
|
if (clcf->keepalive_header
|
||||||
|
&& (r->headers_in.gecko || r->headers_in.konqueror))
|
||||||
|
{
|
||||||
len += sizeof("Keep-Alive: timeout=") - 1 + TIME_T_LEN + 2;
|
len += sizeof("Keep-Alive: timeout=") - 1 + TIME_T_LEN + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +380,9 @@ static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
|
|||||||
b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
|
b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
|
||||||
sizeof("Connection: keep-alive" CRLF) - 1);
|
sizeof("Connection: keep-alive" CRLF) - 1);
|
||||||
|
|
||||||
if (clcf->keepalive_header) {
|
if (clcf->keepalive_header
|
||||||
|
&& (r->headers_in.gecko || r->headers_in.konqueror))
|
||||||
|
{
|
||||||
b->last += ngx_snprintf((char *) b->last,
|
b->last += ngx_snprintf((char *) b->last,
|
||||||
sizeof("Keep-Alive: timeout=") + TIME_T_LEN + 2,
|
sizeof("Keep-Alive: timeout=") + TIME_T_LEN + 2,
|
||||||
"Keep-Alive: timeout=" TIME_T_FMT CRLF,
|
"Keep-Alive: timeout=" TIME_T_FMT CRLF,
|
||||||
|
@ -1569,13 +1569,7 @@ static void ngx_http_set_keepalive(ngx_http_request_t *r)
|
|||||||
|
|
||||||
if (b != c->buffer) {
|
if (b != c->buffer) {
|
||||||
|
|
||||||
/*
|
/* move the large header buffers to the free list */
|
||||||
* If the large header buffers were allocated while the previous
|
|
||||||
* request processing then we do not use c->buffer for
|
|
||||||
* the pipelined request (see ngx_http_init_request()).
|
|
||||||
*
|
|
||||||
* Now we would move the large header buffers to the free list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
||||||
|
|
||||||
@ -1627,15 +1621,6 @@ static void ngx_http_set_keepalive(ngx_http_request_t *r)
|
|||||||
|
|
||||||
hc->pipeline = 0;
|
hc->pipeline = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To keep a memory footprint as small as possible for an idle
|
|
||||||
* keepalive connection we try to free the ngx_http_request_t and
|
|
||||||
* c->buffer's memory if they were allocated outside the c->pool.
|
|
||||||
* The large header buffers are always allocated outside the c->pool and
|
|
||||||
* are freed too.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (ngx_pfree(c->pool, r) == NGX_OK) {
|
if (ngx_pfree(c->pool, r) == NGX_OK) {
|
||||||
hc->request = NULL;
|
hc->request = NULL;
|
||||||
}
|
}
|
||||||
@ -1643,12 +1628,6 @@ static void ngx_http_set_keepalive(ngx_http_request_t *r)
|
|||||||
b = c->buffer;
|
b = c->buffer;
|
||||||
|
|
||||||
if (ngx_pfree(c->pool, b->start) == NGX_OK) {
|
if (ngx_pfree(c->pool, b->start) == NGX_OK) {
|
||||||
|
|
||||||
/*
|
|
||||||
* the special note for ngx_http_keepalive_handler() that
|
|
||||||
* c->buffer's memory was freed
|
|
||||||
*/
|
|
||||||
|
|
||||||
b->pos = NULL;
|
b->pos = NULL;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -1711,7 +1690,7 @@ static void ngx_http_set_keepalive(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* if ngx_http_request_t was freed then we need some other place */
|
/* if "keepalive_buffers off" then we need some other place */
|
||||||
r->http_state = NGX_HTTP_KEEPALIVE_STATE;
|
r->http_state = NGX_HTTP_KEEPALIVE_STATE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1760,13 +1739,6 @@ static void ngx_http_keepalive_handler(ngx_event_t *rev)
|
|||||||
size = b->end - b->start;
|
size = b->end - b->start;
|
||||||
|
|
||||||
if (b->pos == NULL) {
|
if (b->pos == NULL) {
|
||||||
|
|
||||||
/*
|
|
||||||
* The c->buffer's memory was freed by ngx_http_set_keepalive().
|
|
||||||
* However, the c->buffer->start and c->buffer->end were not changed
|
|
||||||
* to keep the buffer size.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!(b->pos = ngx_palloc(c->pool, size))) {
|
if (!(b->pos = ngx_palloc(c->pool, size))) {
|
||||||
ngx_http_close_connection(c);
|
ngx_http_close_connection(c);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user