jnunemaker/httparty — pull request #337 by manygrams (2014-10-21 22:47:25+00:00)
Title: set correct path on redirect to filename

I apologize if this is heinous - I'm completely new to how HTTP works, and this is just to fix a problem I've had a couple times.

When I make a GET request to a certain website, I get a 302 response with the location header set to the same filename (but without the full path) with a different query string. When attempting to follow that redirect, httparty makes a GET request to a broken url and I get an `getaddrinfo: nodename nor servname provided, or not known (SocketError)` exception.

For example:
- GET `http://example.com/foo/bar`
- Server responds 302 with location header set to `bar?token=123`
- On https://github.com/jnunemaker/httparty/blob/master/lib/httparty/request.rb#L59, `#uri` sets `new_uri` to `http://example.combar?token=123`
- Sadness :(