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

Redirections to other domains break persistent client #557

Open tycooon opened 5 years ago

tycooon commented 5 years ago
client = HTTP.persistent("https://example.com").follow
client.get(some_url)

In case some_url redirects to some domain other than example.com, we get the HTTP::StateError: Persistence is enabled for https://example.com, but we got https://some-other-domain.com.

ixti commented 5 years ago

Yeah, that's unfortunate. Redirection and persistence atm are conflicting when used at the same time. That should be solved by introducing HTTP::Session class that will keep pool of persistent-clients per-URI and will properly handle redirections and cookie management.