@@ -630,6 +630,31 @@ describe("http.request module", function()
630630 stream :shutdown ()
631631 end )
632632 end )
633+ it (" works with a tls proxy server" , function ()
634+ test (function (stream )
635+ local h = assert (stream :get_headers ())
636+ assert .truthy (stream :checktls ()) -- came in via TLS
637+ local _ , host , port = stream :localname ()
638+ local authority = http_util .to_authority (host , port , " http" )
639+ assert .same (" http" , h :get (" :scheme" ))
640+ assert .same (authority , h :get " :authority" )
641+ assert .same (" /" , h :get (" :path" ))
642+ local resp_headers = new_headers ()
643+ resp_headers :append (" :status" , " 200" )
644+ assert (stream :write_headers (resp_headers , false ))
645+ assert (stream :write_chunk (" hello world" , true ))
646+ end , function (req )
647+ req .proxy = {
648+ scheme = " https" ;
649+ host = req .host ;
650+ port = req .port ;
651+ }
652+ local headers , stream = assert (req :go ())
653+ assert .same (" 200" , headers :get (" :status" ))
654+ assert .same (" hello world" , assert (stream :get_body_as_string ()))
655+ stream :shutdown ()
656+ end )
657+ end )
633658 it (" works with a proxy server with a path component" , function ()
634659 test (function (stream )
635660 local h = assert (stream :get_headers ())
0 commit comments