comparison src/http/modules/ngx_http_proxy_module.c @ 352:84b8345f70d5 NGINX_0_6_20

nginx 0.6.20 *) Bugfix: a segmentation fault might occur in worker process if a "proxy_pass" directive with URI-part was used; bug appeared in 0.6.19.
author Igor Sysoev <http://sysoev.ru>
date Wed, 28 Nov 2007 00:00:00 +0300
parents e10168d6e371
children 583decdb82a4
comparison
equal deleted inserted replaced
351:4bc23dc655fd 352:84b8345f70d5
635 635
636 u = r->upstream; 636 u = r->upstream;
637 637
638 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); 638 plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
639 639
640 len = sizeof(ngx_http_proxy_version) - 1 + sizeof(CRLF) - 1;
641
642 if (u->method.len) { 640 if (u->method.len) {
643 /* HEAD was changed to GET to cache response */ 641 /* HEAD was changed to GET to cache response */
644 method = u->method; 642 method = u->method;
645 method.len++; 643 method.len++;
646 644
650 } else { 648 } else {
651 method = r->method_name; 649 method = r->method_name;
652 method.len++; 650 method.len++;
653 } 651 }
654 652
653 len = method.len + sizeof(ngx_http_proxy_version) - 1 + sizeof(CRLF) - 1;
654
655 escape = 0; 655 escape = 0;
656 loc_len = 0; 656 loc_len = 0;
657 unparsed_uri = 0; 657 unparsed_uri = 0;
658 658
659 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module); 659 ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
660 660
661 if (plcf->proxy_lengths) { 661 if (plcf->proxy_lengths) {
662 len += method.len + ctx->vars.uri.len; 662 len += ctx->vars.uri.len;
663 663
664 } else if (ctx->vars.uri.len == 0 && r->valid_unparsed_uri && r == r->main) 664 } else if (ctx->vars.uri.len == 0 && r->valid_unparsed_uri && r == r->main)
665 { 665 {
666 unparsed_uri = 1; 666 unparsed_uri = 1;
667 len += method.len + r->unparsed_uri.len; 667 len += r->unparsed_uri.len;
668 668
669 } else { 669 } else {
670 loc_len = (r->valid_location && ctx->vars.uri.len) ? 670 loc_len = (r->valid_location && ctx->vars.uri.len) ?
671 plcf->location.len : 0; 671 plcf->location.len : 0;
672 672