diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gun_SUITE.erl | 2 | ||||
-rw-r--r-- | test/rfc7231_SUITE.erl | 36 |
2 files changed, 19 insertions, 19 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl index 9a49ff8..e7b660d 100644 --- a/test/gun_SUITE.erl +++ b/test/gun_SUITE.erl @@ -260,7 +260,7 @@ transform_header_name(_) -> {ok, Data} = gen_tcp:recv(ClientSocket, 0, 5000), %% We do some very crude parsing of the response headers %% to check that the header name was properly transformed. - Lines = binary:split(Data, <<"\r\n">>), + Lines = binary:split(Data, <<"\r\n">>, [global]), HostLines = [L || <<"HOST: ", _/bits>> = L <- Lines], 1 = length(HostLines), ok. diff --git a/test/rfc7231_SUITE.erl b/test/rfc7231_SUITE.erl index f985bd8..5f7bd6f 100644 --- a/test/rfc7231_SUITE.erl +++ b/test/rfc7231_SUITE.erl @@ -182,9 +182,9 @@ do_connect_http(Transport) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = do_receive(ProxyPid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), - Len = byte_size(Authority), - <<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>> - = do_receive(OriginPid), + Data = do_receive(OriginPid), + Lines = binary:split(Data, <<"\r\n">>, [global]), + [<<"host: ", Authority/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines], #{ transport := Transport, protocol := http, @@ -271,9 +271,9 @@ connect_through_multiple_proxies(_) -> {request, <<"CONNECT">>, Authority2, 'HTTP/1.1', _} = do_receive(Proxy2Pid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef2), _ = gun:get(ConnPid, "/proxied"), - Len = byte_size(Authority2), - <<"GET /proxied HTTP/1.1\r\nhost: ", Authority2:Len/binary, "\r\n", _/bits>> - = do_receive(OriginPid), + Data = do_receive(OriginPid), + Lines = binary:split(Data, <<"\r\n">>, [global]), + [<<"host: ", Authority2/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines], #{ transport := tcp, protocol := http, @@ -309,9 +309,9 @@ connect_delay(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = do_receive(ProxyPid, 3000), {response, fin, 201, _} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), - Len = byte_size(Authority), - <<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>> - = do_receive(OriginPid), + Data = do_receive(OriginPid), + Lines = binary:split(Data, <<"\r\n">>, [global]), + [<<"host: ", Authority/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines], #{ transport := tcp, protocol := http, @@ -341,9 +341,9 @@ connect_response_201(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = do_receive(ProxyPid), {response, fin, 201, _} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), - Len = byte_size(Authority), - <<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>> - = do_receive(OriginPid), + Data = do_receive(OriginPid), + Lines = binary:split(Data, <<"\r\n">>, [global]), + [<<"host: ", Authority/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines], #{ transport := tcp, protocol := http, @@ -479,9 +479,9 @@ connect_response_ignore_transfer_encoding(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = do_receive(ProxyPid), {response, fin, 200, Headers} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), - Len = byte_size(Authority), - <<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>> - = do_receive(OriginPid), + Data = do_receive(OriginPid), + Lines = binary:split(Data, <<"\r\n">>, [global]), + [<<"host: ", Authority/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines], gun:close(ConnPid). connect_response_ignore_content_length(_) -> @@ -500,7 +500,7 @@ connect_response_ignore_content_length(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = do_receive(ProxyPid), {response, fin, 200, Headers} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), - Len = byte_size(Authority), - <<"GET /proxied HTTP/1.1\r\nhost: ", Authority:Len/binary, "\r\n", _/bits>> - = do_receive(OriginPid), + Data = do_receive(OriginPid), + Lines = binary:split(Data, <<"\r\n">>, [global]), + [<<"host: ", Authority/bits>>] = [L || <<"host: ", _/bits>> = L <- Lines], gun:close(ConnPid). |