aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-09-26 12:08:11 +0200
committerLoïc Hoguin <[email protected]>2018-09-26 12:08:11 +0200
commitf328916937c67b3c9679e4f11d4594c39d36f85d (patch)
tree53c8c3df47443227fc2800ffe450c94ab7e58478 /test
parentbaf0e420917ca1cb2806f8594a6cdb4710d2793d (diff)
downloadgun-f328916937c67b3c9679e4f11d4594c39d36f85d.tar.gz
gun-f328916937c67b3c9679e4f11d4594c39d36f85d.tar.bz2
gun-f328916937c67b3c9679e4f11d4594c39d36f85d.zip
Keep track of the intermediaries the connection go through
Also augment the CONNECT tests to confirm that the intermediaries are accounted for.
Diffstat (limited to 'test')
-rw-r--r--test/rfc7231_SUITE.erl61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/rfc7231_SUITE.erl b/test/rfc7231_SUITE.erl
index 88bc114..a42e06c 100644
--- a/test/rfc7231_SUITE.erl
+++ b/test/rfc7231_SUITE.erl
@@ -178,6 +178,18 @@ do_connect_http(Transport) ->
Len = byte_size(Authority),
<<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>>
= do_receive(OriginPid),
+ #{
+ transport := Transport,
+ protocol := http,
+ origin_host := "localhost",
+ origin_port := OriginPort,
+ intermediaries := [#{
+ type := connect,
+ host := "localhost",
+ port := ProxyPort,
+ transport := tcp,
+ protocol := http
+ }]} = gun:info(ConnPid),
gun:close(ConnPid).
connect_h2c(_) ->
@@ -214,6 +226,18 @@ do_connect_h2(Transport) ->
<<_:Len/binary, _:24, 1:8, _/bits>> ->
ok
end,
+ #{
+ transport := Transport,
+ protocol := http2,
+ origin_host := "localhost",
+ origin_port := OriginPort,
+ intermediaries := [#{
+ type := connect,
+ host := "localhost",
+ port := ProxyPort,
+ transport := tcp,
+ protocol := http
+ }]} = gun:info(ConnPid),
gun:close(ConnPid).
connect_through_multiple_proxies(_) ->
@@ -243,6 +267,24 @@ connect_through_multiple_proxies(_) ->
Len = byte_size(Authority2),
<<"GET /proxied HTTP/1.1\r\nhost: ", Authority2:Len/binary, "\r\n", _/bits>>
= do_receive(OriginPid),
+ #{
+ transport := tcp,
+ protocol := http,
+ origin_host := "localhost",
+ origin_port := OriginPort,
+ intermediaries := [#{
+ type := connect,
+ host := "localhost",
+ port := Proxy1Port,
+ transport := tcp,
+ protocol := http
+ }, #{
+ type := connect,
+ host := "localhost",
+ port := Proxy2Port,
+ transport := tcp,
+ protocol := http
+ }]} = gun:info(ConnPid),
gun:close(ConnPid).
connect_response_201(_) ->
@@ -263,6 +305,18 @@ connect_response_201(_) ->
Len = byte_size(Authority),
<<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>>
= do_receive(OriginPid),
+ #{
+ transport := tcp,
+ protocol := http,
+ origin_host := "localhost",
+ origin_port := OriginPort,
+ intermediaries := [#{
+ type := connect,
+ host := "localhost",
+ port := ProxyPort,
+ transport := tcp,
+ protocol := http
+ }]} = gun:info(ConnPid),
gun:close(ConnPid).
connect_response_302(_) ->
@@ -295,6 +349,13 @@ do_connect_failure(Status) ->
{response, fin, Status, Headers} = gun:await(ConnPid, StreamRef),
FailedStreamRef = gun:get(ConnPid, "/proxied"),
{response, fin, 501, _} = gun:await(ConnPid, FailedStreamRef),
+ #{
+ transport := tcp,
+ protocol := http,
+ origin_host := "localhost",
+ origin_port := ProxyPort,
+ intermediaries := []
+ } = gun:info(ConnPid),
gun:close(ConnPid).
connect_authority_form(_) ->