@@ -594,7 +594,7 @@ function _M.send_request(self, params)
594
594
if params_headers then
595
595
-- We assign one by one so that the metatable can handle case insensitivity
596
596
-- for us. You can blame the spec for this inefficiency.
597
- for k ,v in pairs (params_headers ) do
597
+ for k , v in pairs (params_headers ) do
598
598
headers [k ] = v
599
599
end
600
600
end
@@ -685,8 +685,8 @@ function _M.read_response(self, params)
685
685
-- keepalive is true by default. Determine if this is correct or not.
686
686
local ok , connection = pcall (str_lower , res_headers [" Connection" ])
687
687
if ok then
688
- if (version == 1.1 and connection == " close" ) or
689
- (version == 1.0 and connection ~= " keep-alive" ) then
688
+ if (version == 1.1 and str_find ( connection , " close" , 1 , true ) ) or
689
+ (version == 1.0 and not str_find ( connection , " keep-alive" , 1 , true ) ) then
690
690
self .keepalive = false
691
691
end
692
692
else
738
738
739
739
740
740
function _M .request (self , params )
741
- params = tbl_copy (params ) -- Take by value
741
+ params = tbl_copy (params ) -- Take by value
742
742
local res , err = self :send_request (params )
743
743
if not res then
744
744
return res , err
749
749
750
750
751
751
function _M .request_pipeline (self , requests )
752
- requests = tbl_copy (requests ) -- Take by value
752
+ requests = tbl_copy (requests ) -- Take by value
753
753
754
754
for _ , params in ipairs (requests ) do
755
755
if params .headers and params .headers [" Expect" ] == " 100-continue" then
793
793
794
794
795
795
function _M .request_uri (self , uri , params )
796
- params = tbl_copy (params or {}) -- Take by value
796
+ params = tbl_copy (params or {}) -- Take by value
797
797
798
798
local parsed_uri , err = self :parse_uri (uri , false )
799
799
if not parsed_uri then
@@ -929,18 +929,18 @@ function _M.get_client_body_reader(_, chunksize, sock)
929
929
-- Not yet supported by ngx_lua but should just work...
930
930
return _chunked_body_reader (sock , chunksize )
931
931
else
932
- return nil
932
+ return nil
933
933
end
934
934
end
935
935
936
936
937
937
function _M .proxy_request (self , chunksize )
938
- return self :request {
938
+ return self :request ( {
939
939
method = ngx_req_get_method (),
940
940
path = ngx_re_gsub (ngx_var .uri , " \\ s" , " %20" , " jo" ) .. ngx_var .is_args .. (ngx_var .query_string or " " ),
941
941
body = self :get_client_body_reader (chunksize ),
942
942
headers = ngx_req_get_headers (),
943
- }
943
+ })
944
944
end
945
945
946
946
@@ -953,7 +953,7 @@ function _M.proxy_response(_, response, chunksize)
953
953
ngx .status = response .status
954
954
955
955
-- Filter out hop-by-hop headeres
956
- for k ,v in pairs (response .headers ) do
956
+ for k , v in pairs (response .headers ) do
957
957
if not HOP_BY_HOP_HEADERS [str_lower (k )] then
958
958
ngx_header [k ] = v
959
959
end
979
979
980
980
981
981
function _M .set_proxy_options (self , opts )
982
- self .proxy_opts = tbl_copy (opts ) -- Take by value
982
+ self .proxy_opts = tbl_copy (opts ) -- Take by value
983
983
end
984
984
985
985
@@ -1003,9 +1003,9 @@ function _M.get_proxy_uri(self, scheme, host)
1003
1003
no_proxy_set [host_suffix [1 ]] = true
1004
1004
end
1005
1005
1006
- -- From curl docs:
1007
- -- matched as either a domain which contains the hostname, or the
1008
- -- hostname itself. For example local.com would match local.com,
1006
+ -- From curl docs:
1007
+ -- matched as either a domain which contains the hostname, or the
1008
+ -- hostname itself. For example local.com would match local.com,
1009
1009
-- local.com:80, and www.local.com, but not www.notlocal.com.
1010
1010
--
1011
1011
-- Therefore, we keep stripping subdomains from the host, compare
0 commit comments