Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up tests from #1174 #1175

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions test/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,27 @@ end
# just once.
# https://github.com/JuliaWeb/HTTP.jl/issues/1172

# This proxy accepts two requests, ignoring the content of the request and
# returning 200 each time.
proxy = listen(IPv4(0), 8082)
try
@async begin
sock = accept(proxy)
# Accept the first request (the CONNECT request) unconditionally.
while isopen(sock)
line = readline(sock)
@show 1, line
isempty(line) && break
end
write(sock, "HTTP/1.1 200\r\n\r\n")
# Test that we receive something that looks like a client hello

# Test that we receive something that looks like a TLS client hello
# (indicating that we tried to upgrade the connection to TLS)
line = readline(sock)
@test startswith(line, "\x16")
@test read(sock, UInt8) == 0x16
close(sock)
end

@test_throws HTTP.RequestError HTTP.head("https://$httpbin.com"; proxy="http://localhost:8082", readtimeout=1, retry=false)
@test_throws HTTP.RequestError HTTP.head("https://$httpbin.com";
proxy="http://localhost:8082",
readtimeout=1,
retry=false)
finally
close(proxy)
HTTP.Connections.closeall()
Expand Down
Loading