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

Unexpected behavior with localhost and readtimeout #672

Closed
fredrikekre opened this issue Feb 12, 2021 · 0 comments · Fixed by #675
Closed

Unexpected behavior with localhost and readtimeout #672

fredrikekre opened this issue Feb 12, 2021 · 0 comments · Fixed by #675

Comments

@fredrikekre
Copy link
Member

Over in JuliaPackaging/PkgServer.jl#115 there are problems connecting to a server with the combination of localhost and readtimeout.

Looking at the code I found two things:

  1. localhost is hardcoded to ipv4, but only with readtimeout=0:
    tcp = Sockets.connect(host == "localhost" ? ip"127.0.0.1" : Sockets.getalladdrinfo(host)[1], p)
    while the other code path uses getalladdrinfo("localhost")[1]:
    Sockets.connect!(tcp, Sockets.getalladdrinfo(host)[1], p)
    so if getalladdrinfo("localhost")[1] is the ipv6 address HTTP can't connect.
  2. HTTP.jl seems to never care about getaddrinfo(host)[2:end].

I suggest that HTTP.jl should loop over getalladdrinfo(host) in both code paths. That is what curl seems to do for example (even with --retry=no which is the default).

Related: #511, #512, #428

CC: @staticfloat

fredrikekre added a commit to fredrikekre/HTTP.jl that referenced this issue Feb 19, 2021
fredrikekre added a commit to fredrikekre/HTTP.jl that referenced this issue Feb 19, 2021
fredrikekre added a commit to fredrikekre/HTTP.jl that referenced this issue Feb 19, 2021
fredrikekre added a commit to fredrikekre/HTTP.jl that referenced this issue Feb 19, 2021
quinnj pushed a commit that referenced this issue Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant