comparison src/http/ngx_http_core_module.c @ 222:dd6c66b5b0e2 NGINX_0_3_58

nginx 0.3.58 *) Feature: the "error_page" directive supports the variables. *) Change: now the procfs interface instead of sysctl is used on Linux. *) Change: now the "Content-Type" header line is inherited from first response when the "X-Accel-Redirect" was used. *) Bugfix: the "error_page" directive did not redirect the 413 error. *) Bugfix: the trailing "?" did not remove old arguments if no new arguments were added to a rewritten URI. *) Bugfix: nginx could not run on 64-bit FreeBSD 7.0-CURRENT.
author Igor Sysoev <http://sysoev.ru>
date Mon, 14 Aug 2006 00:00:00 +0400
parents 559bc7ec214e
children 9909a161eb28
comparison
equal deleted inserted replaced
221:52ac9a089ea5 222:dd6c66b5b0e2
698 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 698 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
699 "http cl:%O max:%O", 699 "http cl:%O max:%O",
700 r->headers_in.content_length_n, clcf->client_max_body_size); 700 r->headers_in.content_length_n, clcf->client_max_body_size);
701 701
702 if (r->headers_in.content_length_n != -1 702 if (r->headers_in.content_length_n != -1
703 && !r->discard_body
703 && clcf->client_max_body_size 704 && clcf->client_max_body_size
704 && clcf->client_max_body_size < r->headers_in.content_length_n) 705 && clcf->client_max_body_size < r->headers_in.content_length_n)
705 { 706 {
706 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 707 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
707 "client intented to send too large body: %O bytes", 708 "client intented to send too large body: %O bytes",
926 { 927 {
927 u_char c, *p, *exten; 928 u_char c, *p, *exten;
928 ngx_str_t *type; 929 ngx_str_t *type;
929 ngx_uint_t i, hash; 930 ngx_uint_t i, hash;
930 ngx_http_core_loc_conf_t *clcf; 931 ngx_http_core_loc_conf_t *clcf;
932
933 if (r->headers_out.content_type.len) {
934 return NGX_OK;
935 }
931 936
932 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 937 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
933 938
934 if (r->exten.len) { 939 if (r->exten.len) {
935 940
2686 static char * 2691 static char *
2687 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 2692 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
2688 { 2693 {
2689 ngx_http_core_loc_conf_t *lcf = conf; 2694 ngx_http_core_loc_conf_t *lcf = conf;
2690 2695
2691 ngx_int_t overwrite; 2696 ngx_int_t overwrite;
2692 ngx_uint_t i, n; 2697 ngx_str_t *value, uri;
2693 ngx_str_t *value; 2698 ngx_uint_t i, n, nvar;
2694 ngx_http_err_page_t *err; 2699 ngx_array_t *uri_lengths, *uri_values;
2700 ngx_http_err_page_t *err;
2701 ngx_http_script_compile_t sc;
2695 2702
2696 if (lcf->error_pages == NULL) { 2703 if (lcf->error_pages == NULL) {
2697 lcf->error_pages = ngx_array_create(cf->pool, 4, 2704 lcf->error_pages = ngx_array_create(cf->pool, 4,
2698 sizeof(ngx_http_err_page_t)); 2705 sizeof(ngx_http_err_page_t));
2699 if (lcf->error_pages == NULL) { 2706 if (lcf->error_pages == NULL) {
2730 } else { 2737 } else {
2731 overwrite = -1; 2738 overwrite = -1;
2732 n = 1; 2739 n = 1;
2733 } 2740 }
2734 2741
2742 uri = value[cf->args->nelts - 1];
2743 uri_lengths = NULL;
2744 uri_values = NULL;
2745
2746 nvar = ngx_http_script_variables_count(&uri);
2747
2748 if (nvar) {
2749 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
2750
2751 sc.cf = cf;
2752 sc.source = &uri;
2753 sc.lengths = &uri_lengths;
2754 sc.values = &uri_values;
2755 sc.variables = nvar;
2756 sc.complete_lengths = 1;
2757 sc.complete_values = 1;
2758
2759 if (ngx_http_script_compile(&sc) != NGX_OK) {
2760 return NGX_CONF_ERROR;
2761 }
2762 }
2763
2735 for (i = 1; i < cf->args->nelts - n; i++) { 2764 for (i = 1; i < cf->args->nelts - n; i++) {
2736 err = ngx_array_push(lcf->error_pages); 2765 err = ngx_array_push(lcf->error_pages);
2737 if (err == NULL) { 2766 if (err == NULL) {
2738 return NGX_CONF_ERROR; 2767 return NGX_CONF_ERROR;
2739 } 2768 }
2753 return NGX_CONF_ERROR; 2782 return NGX_CONF_ERROR;
2754 } 2783 }
2755 2784
2756 err->overwrite = (overwrite >= 0) ? overwrite : err->status; 2785 err->overwrite = (overwrite >= 0) ? overwrite : err->status;
2757 2786
2758 err->uri = value[cf->args->nelts - 1]; 2787 err->uri = uri;
2788 err->uri_lengths = uri_lengths;
2789 err->uri_values = uri_values;
2759 } 2790 }
2760 2791
2761 return NGX_CONF_OK; 2792 return NGX_CONF_OK;
2762 } 2793 }
2763 2794
2836 ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data) 2867 ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data)
2837 { 2868 {
2838 #if (NGX_FREEBSD) 2869 #if (NGX_FREEBSD)
2839 ssize_t *np = data; 2870 ssize_t *np = data;
2840 2871
2841 if (*np >= ngx_freebsd_net_inet_tcp_sendspace) { 2872 if ((u_long) *np >= ngx_freebsd_net_inet_tcp_sendspace) {
2842 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2873 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2843 "\"send_lowat\" must be less than %d " 2874 "\"send_lowat\" must be less than %d "
2844 "(sysctl net.inet.tcp.sendspace)", 2875 "(sysctl net.inet.tcp.sendspace)",
2845 ngx_freebsd_net_inet_tcp_sendspace); 2876 ngx_freebsd_net_inet_tcp_sendspace);
2846 2877