Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_proxy_module.c @ 672:f41d4b305d22 NGINX_1_2_0
nginx 1.2.0
*) Bugfix: a segmentation fault might occur in a worker process if the
"try_files" directive was used; the bug had appeared in 1.1.19.
*) Bugfix: response might be truncated if there were more than IOV_MAX
buffers used.
*) Bugfix: in the "crop" parameter of the "image_filter" directive.
Thanks to Maxim Bublis.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 23 Apr 2012 00:00:00 +0400 |
parents | bf8b55a5ac89 |
children | 6db6e93f55ee |
comparison
equal
deleted
inserted
replaced
671:47cb3497fbab | 672:f41d4b305d22 |
---|---|
1495 ngx_http_proxy_ctx_t *ctx; | 1495 ngx_http_proxy_ctx_t *ctx; |
1496 | 1496 |
1497 u = r->upstream; | 1497 u = r->upstream; |
1498 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | 1498 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
1499 | 1499 |
1500 if (ctx == NULL) { | |
1501 return NGX_ERROR; | |
1502 } | |
1503 | |
1500 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1504 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1501 "http proxy filter init s:%d h:%d c:%d l:%O", | 1505 "http proxy filter init s:%d h:%d c:%d l:%O", |
1502 u->headers_in.status_n, ctx->head, u->headers_in.chunked, | 1506 u->headers_in.status_n, ctx->head, u->headers_in.chunked, |
1503 u->headers_in.content_length_n); | 1507 u->headers_in.content_length_n); |
1504 | 1508 |
1634 sw_trailer_header, | 1638 sw_trailer_header, |
1635 sw_trailer_header_almost_done | 1639 sw_trailer_header_almost_done |
1636 } state; | 1640 } state; |
1637 | 1641 |
1638 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | 1642 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
1643 | |
1644 if (ctx == NULL) { | |
1645 return NGX_ERROR; | |
1646 } | |
1647 | |
1639 state = ctx->state; | 1648 state = ctx->state; |
1640 | 1649 |
1641 if (state == sw_chunk_data && ctx->size == 0) { | 1650 if (state == sw_chunk_data && ctx->size == 0) { |
1642 state = sw_after_data; | 1651 state = sw_after_data; |
1643 } | 1652 } |
1881 } | 1890 } |
1882 | 1891 |
1883 r = p->input_ctx; | 1892 r = p->input_ctx; |
1884 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | 1893 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
1885 | 1894 |
1895 if (ctx == NULL) { | |
1896 return NGX_ERROR; | |
1897 } | |
1898 | |
1886 b = NULL; | 1899 b = NULL; |
1887 prev = &buf->shadow; | 1900 prev = &buf->shadow; |
1888 | 1901 |
1889 for ( ;; ) { | 1902 for ( ;; ) { |
1890 | 1903 |
2062 ngx_chain_t *cl, **ll; | 2075 ngx_chain_t *cl, **ll; |
2063 ngx_http_upstream_t *u; | 2076 ngx_http_upstream_t *u; |
2064 ngx_http_proxy_ctx_t *ctx; | 2077 ngx_http_proxy_ctx_t *ctx; |
2065 | 2078 |
2066 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | 2079 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
2080 | |
2081 if (ctx == NULL) { | |
2082 return NGX_ERROR; | |
2083 } | |
2084 | |
2067 u = r->upstream; | 2085 u = r->upstream; |
2068 buf = &u->buffer; | 2086 buf = &u->buffer; |
2069 | 2087 |
2070 buf->pos = buf->last; | 2088 buf->pos = buf->last; |
2071 buf->last += bytes; | 2089 buf->last += bytes; |
2732 conf->upstream.busy_buffers_size_conf; | 2750 conf->upstream.busy_buffers_size_conf; |
2733 } | 2751 } |
2734 | 2752 |
2735 if (conf->upstream.busy_buffers_size < size) { | 2753 if (conf->upstream.busy_buffers_size < size) { |
2736 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2754 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2737 "\"proxy_busy_buffers_size\" must be equal or bigger than " | 2755 "\"proxy_busy_buffers_size\" must be equal to or greater than " |
2738 "maximum of the value of \"proxy_buffer_size\" and " | 2756 "the maximum of the value of \"proxy_buffer_size\" and " |
2739 "one of the \"proxy_buffers\""); | 2757 "one of the \"proxy_buffers\""); |
2740 | 2758 |
2741 return NGX_CONF_ERROR; | 2759 return NGX_CONF_ERROR; |
2742 } | 2760 } |
2743 | 2761 |
2763 conf->upstream.temp_file_write_size_conf; | 2781 conf->upstream.temp_file_write_size_conf; |
2764 } | 2782 } |
2765 | 2783 |
2766 if (conf->upstream.temp_file_write_size < size) { | 2784 if (conf->upstream.temp_file_write_size < size) { |
2767 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2785 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2768 "\"proxy_temp_file_write_size\" must be equal or bigger than " | 2786 "\"proxy_temp_file_write_size\" must be equal to or greater " |
2769 "maximum of the value of \"proxy_buffer_size\" and " | 2787 "than the maximum of the value of \"proxy_buffer_size\" and " |
2770 "one of the \"proxy_buffers\""); | 2788 "one of the \"proxy_buffers\""); |
2771 | 2789 |
2772 return NGX_CONF_ERROR; | 2790 return NGX_CONF_ERROR; |
2773 } | 2791 } |
2774 | 2792 |
2786 if (conf->upstream.max_temp_file_size != 0 | 2804 if (conf->upstream.max_temp_file_size != 0 |
2787 && conf->upstream.max_temp_file_size < size) | 2805 && conf->upstream.max_temp_file_size < size) |
2788 { | 2806 { |
2789 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2807 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2790 "\"proxy_max_temp_file_size\" must be equal to zero to disable " | 2808 "\"proxy_max_temp_file_size\" must be equal to zero to disable " |
2791 "the temporary files usage or must be equal or bigger than " | 2809 "temporary files usage or must be equal to or greater than " |
2792 "maximum of the value of \"proxy_buffer_size\" and " | 2810 "the maximum of the value of \"proxy_buffer_size\" and " |
2793 "one of the \"proxy_buffers\""); | 2811 "one of the \"proxy_buffers\""); |
2794 | 2812 |
2795 return NGX_CONF_ERROR; | 2813 return NGX_CONF_ERROR; |
2796 } | 2814 } |
2797 | 2815 |
3423 #endif | 3441 #endif |
3424 || clcf->noname) | 3442 || clcf->noname) |
3425 { | 3443 { |
3426 if (plcf->vars.uri.len) { | 3444 if (plcf->vars.uri.len) { |
3427 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3445 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3428 "\"proxy_pass\" may not have URI part in " | 3446 "\"proxy_pass\" cannot have URI part in " |
3429 "location given by regular expression, " | 3447 "location given by regular expression, " |
3430 "or inside named location, " | 3448 "or inside named location, " |
3431 "or inside the \"if\" statement, " | 3449 "or inside \"if\" statement, " |
3432 "or inside the \"limit_except\" block"); | 3450 "or inside \"limit_except\" block"); |
3433 return NGX_CONF_ERROR; | 3451 return NGX_CONF_ERROR; |
3434 } | 3452 } |
3435 | 3453 |
3436 plcf->location.len = 0; | 3454 plcf->location.len = 0; |
3437 } | 3455 } |
3496 } | 3514 } |
3497 | 3515 |
3498 if (ngx_strcmp(value[1].data, "default") == 0) { | 3516 if (ngx_strcmp(value[1].data, "default") == 0) { |
3499 if (plcf->proxy_lengths) { | 3517 if (plcf->proxy_lengths) { |
3500 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3518 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3501 "\"proxy_redirect default\" may not be used " | 3519 "\"proxy_redirect default\" cannot be used " |
3502 "with \"proxy_pass\" directive with variables"); | 3520 "with \"proxy_pass\" directive with variables"); |
3503 return NGX_CONF_ERROR; | 3521 return NGX_CONF_ERROR; |
3504 } | 3522 } |
3505 | 3523 |
3506 if (plcf->url.data == NULL) { | 3524 if (plcf->url.data == NULL) { |
3507 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3525 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3508 "\"proxy_redirect default\" must go " | 3526 "\"proxy_redirect default\" should be placed " |
3509 "after the \"proxy_pass\" directive"); | 3527 "after the \"proxy_pass\" directive"); |
3510 return NGX_CONF_ERROR; | 3528 return NGX_CONF_ERROR; |
3511 } | 3529 } |
3512 | 3530 |
3513 pr->handler = ngx_http_proxy_rewrite_complex_handler; | 3531 pr->handler = ngx_http_proxy_rewrite_complex_handler; |