comparison src/http/ngx_http_core_module.c @ 84:991c6e4c7654 NGINX_0_1_42

nginx 0.1.42 *) Bugfix: if the request URI had a zero length after the processing in the ngx_http_proxy_module, then the segmentation fault or bus error occurred in the ngx_http_proxy_module. *) Bugfix: the "limit_rate" directive did not work inside the "if" block; bug appeared in 0.1.38.
author Igor Sysoev <http://sysoev.ru>
date Tue, 23 Aug 2005 00:00:00 +0400
parents 6ae11d59d10e
children e916a291e9aa
comparison
equal deleted inserted replaced
83:8216480b2a2e 84:991c6e4c7654
584 584
585 if (!r->internal && clcf->internal) { 585 if (!r->internal && clcf->internal) {
586 return NGX_HTTP_NOT_FOUND; 586 return NGX_HTTP_NOT_FOUND;
587 } 587 }
588 588
589 r->connection->log->file = clcf->err_log->file; 589 ngx_http_update_location_config(r);
590 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
591 r->connection->log->log_level = clcf->err_log->log_level;
592 }
593
594 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
595 r->connection->sendfile = 1;
596
597 } else {
598 r->connection->sendfile = 0;
599 }
600
601 if (r->keepalive && clcf->keepalive_timeout == 0) {
602 r->keepalive = 0;
603 }
604
605 if (!clcf->tcp_nopush) {
606 /* disable TCP_NOPUSH/TCP_CORK use */
607 r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
608 }
609
610 590
611 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 591 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
612 "http cl:%z max:%uz", 592 "http cl:%z max:%uz",
613 r->headers_in.content_length_n, clcf->client_max_body_size); 593 r->headers_in.content_length_n, clcf->client_max_body_size);
614 594
638 r->headers_out.location->value = clcf->name; 618 r->headers_out.location->value = clcf->name;
639 619
640 return NGX_HTTP_MOVED_PERMANENTLY; 620 return NGX_HTTP_MOVED_PERMANENTLY;
641 } 621 }
642 622
623 return NGX_OK;
624 }
625
626
627 void
628 ngx_http_update_location_config(ngx_http_request_t *r)
629 {
630 ngx_http_core_loc_conf_t *clcf;
631
632 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
633
634 r->connection->log->file = clcf->err_log->file;
635 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
636 r->connection->log->log_level = clcf->err_log->log_level;
637 }
638
639 if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
640 r->connection->sendfile = 1;
641
642 } else {
643 r->connection->sendfile = 0;
644 }
645
646 if (r->keepalive && clcf->keepalive_timeout == 0) {
647 r->keepalive = 0;
648 }
649
650 if (!clcf->tcp_nopush) {
651 /* disable TCP_NOPUSH/TCP_CORK use */
652 r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
653 }
654
643 r->limit_rate = clcf->limit_rate; 655 r->limit_rate = clcf->limit_rate;
644 656
645 if (clcf->handler) { 657 if (clcf->handler) {
646 r->content_handler = clcf->handler; 658 r->content_handler = clcf->handler;
647 } 659 }
648
649 return NGX_OK;
650 } 660 }
651 661
652 662
653 static ngx_int_t 663 static ngx_int_t
654 ngx_http_core_find_location(ngx_http_request_t *r, 664 ngx_http_core_find_location(ngx_http_request_t *r,
1069 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); 1079 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
1070 } 1080 }
1071 1081
1072 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 1082 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
1073 r->loc_conf = cscf->ctx->loc_conf; 1083 r->loc_conf = cscf->ctx->loc_conf;
1084
1085 ngx_http_update_location_config(r);
1074 1086
1075 r->internal = 1; 1087 r->internal = 1;
1076 1088
1077 ngx_http_handler(r); 1089 ngx_http_handler(r);
1078 1090