Klaus Demo nginx / c3e4746
nginx-0.0.12-2004-09-24-20:12:19 import Igor Sysoev 17 years ago
3 changed file(s) with 53 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
872872
873873 ngx_http_handler_pt *h;
874874
875 ngx_test_null(h, ngx_push_array(
876 &cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers),
877 NGX_ERROR);
875 if (!(h = ngx_array_push(&cmcf->phases[NGX_HTTP_TRANSLATE_PHASE].handlers)))
876 return NGX_ERROR;
877 }
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 ngx_test_null(ctx,
907 ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
908 NGX_CONF_ERROR);
906 if (!(ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)))) {
907 return NGX_CONF_ERROR;
908 }
909909
910910 http_ctx = cf->ctx;
911911 ctx->main_conf = http_ctx->main_conf;
912912
913913 /* the server{}'s srv_conf */
914914
915 ngx_test_null(ctx->srv_conf,
916 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
917 NGX_CONF_ERROR);
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 }
918919
919920 /* the server{}'s loc_conf */
920921
921 ngx_test_null(ctx->loc_conf,
922 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
923 NGX_CONF_ERROR);
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 }
924926
925927 for (m = 0; ngx_modules[m]; m++) {
926928 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
13241326 }
13251327
13261328 ngx_conf_merge_size_value(conf->connection_pool_size,
1327 prev->connection_pool_size, 2048);
1329 prev->connection_pool_size, 256);
13281330 ngx_conf_merge_msec_value(conf->post_accept_timeout,
1329 prev->post_accept_timeout, 30000);
1331 prev->post_accept_timeout, 60000);
13301332 ngx_conf_merge_size_value(conf->request_pool_size,
1331 prev->request_pool_size, 16384);
1333 prev->request_pool_size, (size_t) ngx_pagesize);
13321334 ngx_conf_merge_msec_value(conf->client_header_timeout,
13331335 prev->client_header_timeout, 60000);
13341336 ngx_conf_merge_size_value(conf->client_header_buffer_size,
14611463 ngx_conf_merge_size_value(conf->client_max_body_size,
14621464 prev->client_max_body_size, 10 * 1024 * 1024);
14631465 ngx_conf_merge_size_value(conf->client_body_buffer_size,
1464 prev->client_body_buffer_size, 8192);
1466 prev->client_body_buffer_size,
1467 (size_t) 4 * ngx_pagesize);
14651468 ngx_conf_merge_msec_value(conf->client_body_timeout,
14661469 prev->client_body_timeout, 60000);
14671470 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
249 && (r->headers_in.gecko || r->headers_in.konqueror))
250 {
248 if (clcf->keepalive_header) {
251249 len += sizeof("Keep-Alive: timeout=") - 1 + TIME_T_LEN + 2;
252250 }
253251
379377 b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
380378 sizeof("Connection: keep-alive" CRLF) - 1);
381379
382 if (clcf->keepalive_header
383 && (r->headers_in.gecko || r->headers_in.konqueror))
384 {
380 if (clcf->keepalive_header) {
385381 b->last += ngx_snprintf((char *) b->last,
386382 sizeof("Keep-Alive: timeout=") + TIME_T_LEN + 2,
387383 "Keep-Alive: timeout=" TIME_T_FMT CRLF,
483483 {
484484 u_char *p;
485485 ssize_t n;
486 ngx_int_t rc, rv, offset;
486 ngx_int_t rc, rv;
487487 ngx_connection_t *c;
488488 ngx_http_request_t *r;
489489 ngx_http_log_ctx_t *ctx;
707707 static void ngx_http_process_request_headers(ngx_event_t *rev)
708708 {
709709 ssize_t n;
710 ngx_int_t rc, rv, i, offset;
710 ngx_int_t rc, rv, i;
711711 ngx_table_elt_t *h, **cookie;
712712 ngx_connection_t *c;
713713 ngx_http_request_t *r;
938938 ngx_uint_t request_line)
939939 {
940940 u_char *old, *new;
941 ngx_int_t offset;
942941 ngx_buf_t *b;
943942 ngx_http_connection_t *hc;
944943 ngx_http_core_srv_conf_t *cscf;
15441543 static void ngx_http_set_keepalive(ngx_http_request_t *r)
15451544 {
15461545 ngx_int_t i;
1547 size_t len;
15481546 ngx_buf_t *b, *f;
15491547 ngx_event_t *rev, *wev;
15501548 ngx_connection_t *c;
15701568
15711569 if (b != c->buffer) {
15721570
1573 /* move the large header buffers to the free list */
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 */
15741578
15751579 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
15761580
16221626
16231627 hc->pipeline = 0;
16241628
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
16251638 if (ngx_pfree(c->pool, r) == NGX_OK) {
16261639 hc->request = NULL;
16271640 }
16291642 b = c->buffer;
16301643
16311644 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
16321651 b->pos = NULL;
16331652
16341653 } else {
16911710 }
16921711
16931712 #if 0
1694 /* if "keepalive_buffers off" then we need some other place */
1713 /* if ngx_http_request_t was freed then we need some other place */
16951714 r->http_state = NGX_HTTP_KEEPALIVE_STATE;
16961715 #endif
16971716
17401759 size = b->end - b->start;
17411760
17421761 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
17431769 if (!(b->pos = ngx_palloc(c->pool, size))) {
17441770 ngx_http_close_connection(c);
17451771 return;