Klaus Demo nginx / 4bed6e3
nginx-0.0.12-2004-09-26-23:01:48 import Igor Sysoev 17 years ago
3 changed file(s) with 24 addition(s) and 51 deletion(s). Raw diff Collapse all Expand all
872872
873873 ngx_http_handler_pt *h;
874874
875 if (!(h = ngx_array_push(&cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers)))
876 return NGX_ERROR;
877 }
875 ngx_test_null(h, ngx_push_array(
876 &cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers),
877 NGX_ERROR);
878878 *h = ngx_http_delay_handler;
879879 #endif
880880
903903 ngx_http_core_main_conf_t *cmcf;
904904 ngx_http_core_srv_conf_t *cscf, **cscfp;
905905
906 if (!(ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)))) {
907 return NGX_CONF_ERROR;
908 }
906 ngx_test_null(ctx,
907 ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
908 NGX_CONF_ERROR);
909909
910910 http_ctx = cf->ctx;
911911 ctx->main_conf = http_ctx->main_conf;
912912
913913 /* the server{}'s srv_conf */
914914
915 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
916 if (ctx->srv_conf == NULL) {
917 return NGX_CONF_ERROR;
918 }
915 ngx_test_null(ctx->srv_conf,
916 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
917 NGX_CONF_ERROR);
919918
920919 /* the server{}'s loc_conf */
921920
922 ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
923 if (ctx->loc_conf == NULL) {
924 return NGX_CONF_ERROR;
925 }
921 ngx_test_null(ctx->loc_conf,
922 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
923 NGX_CONF_ERROR);
926924
927925 for (m = 0; ngx_modules[m]; m++) {
928926 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
13261324 }
13271325
13281326 ngx_conf_merge_size_value(conf->connection_pool_size,
1329 prev->connection_pool_size, 256);
1327 prev->connection_pool_size, 2048);
13301328 ngx_conf_merge_msec_value(conf->post_accept_timeout,
1331 prev->post_accept_timeout, 60000);
1329 prev->post_accept_timeout, 30000);
13321330 ngx_conf_merge_size_value(conf->request_pool_size,
1333 prev->request_pool_size, (size_t) ngx_pagesize);
1331 prev->request_pool_size, 16384);
13341332 ngx_conf_merge_msec_value(conf->client_header_timeout,
13351333 prev->client_header_timeout, 60000);
13361334 ngx_conf_merge_size_value(conf->client_header_buffer_size,
14631461 ngx_conf_merge_size_value(conf->client_max_body_size,
14641462 prev->client_max_body_size, 10 * 1024 * 1024);
14651463 ngx_conf_merge_size_value(conf->client_body_buffer_size,
1466 prev->client_body_buffer_size,
1467 (size_t) 4 * ngx_pagesize);
1464 prev->client_body_buffer_size, 8192);
14681465 ngx_conf_merge_msec_value(conf->client_body_timeout,
14691466 prev->client_body_timeout, 60000);
14701467 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
245245 * Konqueror keeps the connection alive for about N seconds.
246246 */
247247
248 if (clcf->keepalive_header) {
248 if (clcf->keepalive_header
249 && (r->headers_in.gecko || r->headers_in.konqueror))
250 {
249251 len += sizeof("Keep-Alive: timeout=") - 1 + TIME_T_LEN + 2;
250252 }
251253
377379 b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
378380 sizeof("Connection: keep-alive" CRLF) - 1);
379381
380 if (clcf->keepalive_header) {
382 if (clcf->keepalive_header
383 && (r->headers_in.gecko || r->headers_in.konqueror))
384 {
381385 b->last += ngx_snprintf((char *) b->last,
382386 sizeof("Keep-Alive: timeout=") + TIME_T_LEN + 2,
383387 "Keep-Alive: timeout=" TIME_T_FMT CRLF,
15681568
15691569 if (b != c->buffer) {
15701570
1571 /*
1572 * If the large header buffers were allocated while the previous
1573 * request processing then we do not use c->buffer for
1574 * the pipelined request (see ngx_http_init_request()).
1575 *
1576 * Now we would move the large header buffers to the free list.
1577 */
1571 /* move the large header buffers to the free list */
15781572
15791573 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
15801574
16261620
16271621 hc->pipeline = 0;
16281622
1629
1630 /*
1631 * To keep a memory footprint as small as possible for an idle
1632 * keepalive connection we try to free the ngx_http_request_t and
1633 * c->buffer's memory if they were allocated outside the c->pool.
1634 * The large header buffers are always allocated outside the c->pool and
1635 * are freed too.
1636 */
1637
16381623 if (ngx_pfree(c->pool, r) == NGX_OK) {
16391624 hc->request = NULL;
16401625 }
16421627 b = c->buffer;
16431628
16441629 if (ngx_pfree(c->pool, b->start) == NGX_OK) {
1645
1646 /*
1647 * the special note for ngx_http_keepalive_handler() that
1648 * c->buffer's memory was freed
1649 */
1650
16511630 b->pos = NULL;
16521631
16531632 } else {
17101689 }
17111690
17121691 #if 0
1713 /* if ngx_http_request_t was freed then we need some other place */
1692 /* if "keepalive_buffers off" then we need some other place */
17141693 r->http_state = NGX_HTTP_KEEPALIVE_STATE;
17151694 #endif
17161695
17591738 size = b->end - b->start;
17601739
17611740 if (b->pos == NULL) {
1762
1763 /*
1764 * The c->buffer's memory was freed by ngx_http_set_keepalive().
1765 * However, the c->buffer->start and c->buffer->end were not changed
1766 * to keep the buffer size.
1767 */
1768
17691741 if (!(b->pos = ngx_palloc(c->pool, size))) {
17701742 ngx_http_close_connection(c);
17711743 return;