comparison src/http/modules/ngx_http_proxy_module.c @ 520:24b676623d4f NGINX_0_8_7

nginx 0.8.7 *) Change: minimum supported OpenSSL version is 0.9.7. *) Change: the "ask" parameter of the "ssl_verify_client" directive was changed to the "optional" parameter and now it checks a client certificate if it was offered. Thanks to Brice Figureau. *) Feature: the $ssl_client_verify variable. Thanks to Brice Figureau. *) Feature: the "ssl_crl" directive. Thanks to Brice Figureau. *) Feature: the "proxy" parameter of the "geo" directive. *) Feature: the "image_filter" directive supports variables for setting size. *) Bugfix: the $ssl_client_cert variable usage corrupted memory; the bug had appeared in 0.7.7. Thanks to Sergey Zhuravlev. *) Bugfix: "proxy_pass_header" and "fastcgi_pass_header" directives did not pass to a client the "X-Accel-Redirect", "X-Accel-Limit-Rate", "X-Accel-Buffering", and "X-Accel-Charset" lines from backend response header. Thanks to Maxim Dounin. *) Bugfix: in handling "Last-Modified" and "Accept-Ranges" backend response header lines; the bug had appeared in 0.7.44. Thanks to Maxim Dounin. *) Bugfix: the "[alert] zero size buf" error if subrequest returns an empty response; the bug had appeared in 0.8.5.
author Igor Sysoev <http://sysoev.ru>
date Mon, 27 Jul 2009 00:00:00 +0400
parents f0cac61857ae
children c04fa65fe604
comparison
equal deleted inserted replaced
519:41f4e459ace8 520:24b676623d4f
588 ngx_int_t rc; 588 ngx_int_t rc;
589 ngx_http_upstream_t *u; 589 ngx_http_upstream_t *u;
590 ngx_http_proxy_ctx_t *ctx; 590 ngx_http_proxy_ctx_t *ctx;
591 ngx_http_proxy_loc_conf_t *plcf; 591 ngx_http_proxy_loc_conf_t *plcf;
592 592
593 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); 593 if (ngx_http_upstream_create(r) != NGX_OK) {
594 if (u == NULL) {
595 return NGX_HTTP_INTERNAL_SERVER_ERROR; 594 return NGX_HTTP_INTERNAL_SERVER_ERROR;
596 } 595 }
597
598 r->upstream = u;
599 596
600 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t)); 597 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t));
601 if (ctx == NULL) { 598 if (ctx == NULL) {
602 return NGX_ERROR; 599 return NGX_ERROR;
603 } 600 }
604 601
605 ngx_http_set_ctx(r, ctx, ngx_http_proxy_module); 602 ngx_http_set_ctx(r, ctx, ngx_http_proxy_module);
606 603
607 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); 604 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
605
606 u = r->upstream;
608 607
609 if (plcf->proxy_lengths == 0) { 608 if (plcf->proxy_lengths == 0) {
610 ctx->vars = plcf->vars; 609 ctx->vars = plcf->vars;
611 u->schema = plcf->vars.schema; 610 u->schema = plcf->vars.schema;
612 #if (NGX_HTTP_SSL) 611 #if (NGX_HTTP_SSL)
616 } else { 615 } else {
617 if (ngx_http_proxy_eval(r, ctx, plcf) != NGX_OK) { 616 if (ngx_http_proxy_eval(r, ctx, plcf) != NGX_OK) {
618 return NGX_HTTP_INTERNAL_SERVER_ERROR; 617 return NGX_HTTP_INTERNAL_SERVER_ERROR;
619 } 618 }
620 } 619 }
621
622 u->peer.log = r->connection->log;
623 u->peer.log_error = NGX_ERROR_ERR;
624 #if (NGX_THREADS)
625 u->peer.lock = &r->connection->lock;
626 #endif
627 620
628 u->output.tag = (ngx_buf_tag_t) &ngx_http_proxy_module; 621 u->output.tag = (ngx_buf_tag_t) &ngx_http_proxy_module;
629 622
630 u->conf = &plcf->upstream; 623 u->conf = &plcf->upstream;
631 624
2590 return "is duplicate"; 2583 return "is duplicate";
2591 } 2584 }
2592 2585
2593 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); 2586 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
2594 2587
2588 clcf->handler = ngx_http_proxy_handler;
2589
2590 if (clcf->name.data[clcf->name.len - 1] == '/') {
2591 clcf->auto_redirect = 1;
2592 }
2593
2595 value = cf->args->elts; 2594 value = cf->args->elts;
2596 2595
2597 url = &value[1]; 2596 url = &value[1];
2598 2597
2599 n = ngx_http_script_variables_count(url); 2598 n = ngx_http_script_variables_count(url);
2618 if (ngx_http_proxy_set_ssl(cf, plcf) != NGX_OK) { 2617 if (ngx_http_proxy_set_ssl(cf, plcf) != NGX_OK) {
2619 return NGX_CONF_ERROR; 2618 return NGX_CONF_ERROR;
2620 } 2619 }
2621 #endif 2620 #endif
2622 2621
2623 clcf->handler = ngx_http_proxy_handler;
2624
2625 return NGX_CONF_OK; 2622 return NGX_CONF_OK;
2626 } 2623 }
2627 2624
2628 if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) { 2625 if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) {
2629 add = 7; 2626 add = 7;
2665 plcf->vars.schema.len = add; 2662 plcf->vars.schema.len = add;
2666 plcf->vars.schema.data = url->data; 2663 plcf->vars.schema.data = url->data;
2667 plcf->vars.key_start = plcf->vars.schema; 2664 plcf->vars.key_start = plcf->vars.schema;
2668 2665
2669 ngx_http_proxy_set_vars(&u, &plcf->vars); 2666 ngx_http_proxy_set_vars(&u, &plcf->vars);
2670
2671 clcf->handler = ngx_http_proxy_handler;
2672 2667
2673 plcf->location = clcf->name; 2668 plcf->location = clcf->name;
2674 2669
2675 if (clcf->named 2670 if (clcf->named
2676 #if (NGX_PCRE) 2671 #if (NGX_PCRE)
2691 plcf->location.len = 0; 2686 plcf->location.len = 0;
2692 } 2687 }
2693 2688
2694 plcf->url = *url; 2689 plcf->url = *url;
2695 2690
2696 if (clcf->name.data[clcf->name.len - 1] == '/') {
2697 clcf->auto_redirect = 1;
2698 }
2699
2700 return NGX_CONF_OK; 2691 return NGX_CONF_OK;
2701 } 2692 }
2702 2693
2703 2694
2704 static char * 2695 static char *