ninenines / gun

HTTP/1.1, HTTP/2, Websocket client (and more) for Erlang/OTP.
ISC License
891 stars 232 forks source link

Accept HTTP/1.0 response to CONNECT #277

Closed krant closed 1 year ago

krant commented 2 years ago

There are still proxies in a wild which respond HTTP/1.0 200 to CONNECT. With this PR Gun would support those proxies.

essen commented 2 years ago

Please be more specific. Which proxies?

krant commented 2 years ago

For example squidproxies.com still sells squid/3.1.23, you could check it with one of IP we bought from them:

curl -kvx 23.19.34.138:8800 https://httpbin.org/ip

(it will give you an error because of authentication, but HTTP/1.0 and squid version is there)

essen commented 2 years ago

Your curl command is something else. It's fine to return an HTTP/1.0 for a non-2xx response to a CONNECT request. Gun already handle those cases properly I believe.

It is the HTTP/1.0 2xx responses to CONNECT specifically that are in question here.

In any case I cannot think of a reason why this would create problems. On the other hand it would be good to add a comment explaining why we also accept HTTP/1.0 and that it is unlikely to cause problems because the tunnel takes over the entire connection.

Also one or more tests to confirm that the code behaves as intended.

essen commented 1 year ago

This has been fixed today. Closing, thanks!