Mercurial > hg > nginx
comparison src/http/modules/ngx_http_proxy_module.c @ 3425:0189a8f4c7c3 stable-0.7
merge r2990, r3324, r3384, r3419:
various proxy/FastCGI fixes:
*) do auto redirect for proxy_pass/fastcgi_pass with variables
*) allow "proxy_pass http://$backend" without URI part
*) add conf/fastcgi.conf
*) delete u->cleanup mark, this fixes large values in $upstream_response_time,
the bug had been introduced in r3246
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 01 Feb 2010 14:01:24 +0000 |
parents | 61962127b166 |
children | 3354dfba9da4 |
comparison
equal
deleted
inserted
replaced
3424:c6ecb3fe577b | 3425:0189a8f4c7c3 |
---|---|
715 } | 715 } |
716 | 716 |
717 return NGX_ERROR; | 717 return NGX_ERROR; |
718 } | 718 } |
719 | 719 |
720 if (url.uri.len && url.uri.data[0] == '?') { | 720 if (url.uri.len) { |
721 p = ngx_pnalloc(r->pool, url.uri.len + 1); | 721 if (url.uri.data[0] == '?') { |
722 if (p == NULL) { | 722 p = ngx_pnalloc(r->pool, url.uri.len + 1); |
723 return NGX_ERROR; | 723 if (p == NULL) { |
724 } | 724 return NGX_ERROR; |
725 | 725 } |
726 *p++ = '/'; | 726 |
727 ngx_memcpy(p, url.uri.data, url.uri.len); | 727 *p++ = '/'; |
728 | 728 ngx_memcpy(p, url.uri.data, url.uri.len); |
729 url.uri.len++; | 729 |
730 url.uri.data = p - 1; | 730 url.uri.len++; |
731 url.uri.data = p - 1; | |
732 } | |
733 | |
734 } else { | |
735 url.uri = r->unparsed_uri; | |
731 } | 736 } |
732 | 737 |
733 ctx->vars.key_start = u->schema; | 738 ctx->vars.key_start = u->schema; |
734 | 739 |
735 ngx_http_proxy_set_vars(&url, &ctx->vars); | 740 ngx_http_proxy_set_vars(&url, &ctx->vars); |
2583 return "is duplicate"; | 2588 return "is duplicate"; |
2584 } | 2589 } |
2585 | 2590 |
2586 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); | 2591 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
2587 | 2592 |
2593 clcf->handler = ngx_http_proxy_handler; | |
2594 | |
2595 if (clcf->name.data[clcf->name.len - 1] == '/') { | |
2596 clcf->auto_redirect = 1; | |
2597 } | |
2598 | |
2588 value = cf->args->elts; | 2599 value = cf->args->elts; |
2589 | 2600 |
2590 url = &value[1]; | 2601 url = &value[1]; |
2591 | 2602 |
2592 n = ngx_http_script_variables_count(url); | 2603 n = ngx_http_script_variables_count(url); |
2611 if (ngx_http_proxy_set_ssl(cf, plcf) != NGX_OK) { | 2622 if (ngx_http_proxy_set_ssl(cf, plcf) != NGX_OK) { |
2612 return NGX_CONF_ERROR; | 2623 return NGX_CONF_ERROR; |
2613 } | 2624 } |
2614 #endif | 2625 #endif |
2615 | 2626 |
2616 clcf->handler = ngx_http_proxy_handler; | |
2617 | |
2618 return NGX_CONF_OK; | 2627 return NGX_CONF_OK; |
2619 } | 2628 } |
2620 | 2629 |
2621 if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) { | 2630 if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) { |
2622 add = 7; | 2631 add = 7; |
2658 plcf->vars.schema.len = add; | 2667 plcf->vars.schema.len = add; |
2659 plcf->vars.schema.data = url->data; | 2668 plcf->vars.schema.data = url->data; |
2660 plcf->vars.key_start = plcf->vars.schema; | 2669 plcf->vars.key_start = plcf->vars.schema; |
2661 | 2670 |
2662 ngx_http_proxy_set_vars(&u, &plcf->vars); | 2671 ngx_http_proxy_set_vars(&u, &plcf->vars); |
2663 | |
2664 clcf->handler = ngx_http_proxy_handler; | |
2665 | 2672 |
2666 plcf->location = clcf->name; | 2673 plcf->location = clcf->name; |
2667 | 2674 |
2668 if (clcf->named | 2675 if (clcf->named |
2669 #if (NGX_PCRE) | 2676 #if (NGX_PCRE) |
2684 plcf->location.len = 0; | 2691 plcf->location.len = 0; |
2685 } | 2692 } |
2686 | 2693 |
2687 plcf->url = *url; | 2694 plcf->url = *url; |
2688 | 2695 |
2689 if (clcf->name.data[clcf->name.len - 1] == '/') { | |
2690 clcf->auto_redirect = 1; | |
2691 } | |
2692 | |
2693 return NGX_CONF_OK; | 2696 return NGX_CONF_OK; |
2694 } | 2697 } |
2695 | 2698 |
2696 | 2699 |
2697 static char * | 2700 static char * |