comparison src/http/modules/ngx_http_proxy_module.c @ 1667:e9bd042134cb

fix segfault
author Igor Sysoev <igor@sysoev.ru>
date Wed, 28 Nov 2007 15:06:05 +0000
parents 13f8dec720b5
children 8075179cae21
comparison
equal deleted inserted replaced
1666:695cb0bf4dc4 1667:e9bd042134cb
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