httprb / http

HTTP (The Gem! a.k.a. http.rb) - a fast Ruby HTTP client with a chainable API, streaming support, and timeouts
MIT License
3.01k stars 321 forks source link

HEAD requests via proxy? #580

Closed wflanagan closed 3 years ago

wflanagan commented 4 years ago

I'm trying to troubleshoot a problem with my HTTP.rb requests.

Specifically, we use a set of proxies for our retrieving (from our API). We have a use case where we are doing HEAD requests to handle URL resolution for shortened URLs.

It seems like HEAD requests are NOT proxied, even with a configured .via on the HTTP client.

Maybe that's by design? Or, maybe I'm doing something wrong. Or, maybe it's never been tested and I'm doing something unique (which I doubt).

This is likely a "support" problem versus a code problem. But, I thought I'd reach out, if nothing else, for others that might hit this problem later and search the issues for a solution.

To test, I created a bit.ly shortened URL, that redirects to httpbin.org. Then, I'm using HTTPlog to check what happens. This is what I see.

D, [2019-12-23T12:01:25.512948 #172604] DEBUG -- : [httplog] Connecting: bit.ly:80
D, [2019-12-23T12:01:25.669973 #172604] DEBUG -- : [httplog] Sending: HEAD http://bit.ly/2s5daUJ
D, [2019-12-23T12:01:25.670066 #172604] DEBUG -- : [httplog] Data: 
D, [2019-12-23T12:01:25.679363 #172604] DEBUG -- : [httplog] Status: 301
D, [2019-12-23T12:01:25.679540 #172604] DEBUG -- : [httplog] Benchmark: 0.157089 seconds
D, [2019-12-23T12:01:25.679662 #172604] DEBUG -- : [httplog] Response:

D, [2019-12-23T12:01:25.680647 #172604] DEBUG -- : [httplog] Connecting: httpbin.org:443
D, [2019-12-23T12:01:26.203292 #172604] DEBUG -- : [httplog] Sending: HEAD https://httpbin.org/ip
D, [2019-12-23T12:01:26.203380 #172604] DEBUG -- : [httplog] Data: 
D, [2019-12-23T12:01:26.203463 #172604] DEBUG -- : [httplog] Status: 200
D, [2019-12-23T12:01:26.203578 #172604] DEBUG -- : [httplog] Benchmark: 0.522617 seconds
D, [2019-12-23T12:01:26.203732 #172604] DEBUG -- : [httplog] Response:

There is nothing in the logs that indicate a proxy connection.

Thoughts?

ixti commented 4 years ago

Please provide a snippet to reproduce the bug.

wflanagan commented 3 years ago

I don't remember what this was, closing at this point.