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

Subtle issue with normalizing URIs #206

Closed
benlovell opened this issue Apr 7, 2015 · 8 comments
Closed

Subtle issue with normalizing URIs #206

benlovell opened this issue Apr 7, 2015 · 8 comments
Assignees

Comments

@benlovell
Copy link

Since 81509bc we've had issues with using this gem to communicate with elasticsearch. It seems that prior to this change, the request URI was being normalized correctly and thus not including the scheme and host segment. As is evidenced below:

screen shot 2015-04-07 at 11 25 17

And after 81509bc:

screen shot 2015-04-07 at 11 26 07

It seems some servers are strict in this regard. Elasticsearch apparently being one of them. 🙈

This is easily resolved by uri.normalize.request_uri instead of just normalizing the URI, but this causes some issues with proxying that I don't really understand.

@ixti
Copy link
Member

ixti commented Apr 7, 2015

Thanks for report. My bad. Will fix today.

@ixti ixti self-assigned this Apr 7, 2015
@ixti ixti added the Regression label Apr 7, 2015
@ixti
Copy link
Member

ixti commented Apr 7, 2015

It should not send schema://hostname inside METHOD ... line.

@ixti
Copy link
Member

ixti commented Apr 7, 2015

Actually I have misunderstood original code and wiped out things that were essential. Will provide a fix ASAP.

ixti added a commit that referenced this issue Apr 7, 2015
@ixti ixti closed this as completed in bc9dd60 Apr 7, 2015
@ixti
Copy link
Member

ixti commented Apr 7, 2015

Released as 0.8.3.

@benlovell
Copy link
Author

❤️

zanker pushed a commit to zanker/http.rb that referenced this issue May 8, 2015
@britishtea
Copy link
Contributor

I ran into an issue today due to this commit.

I often use Charles Proxy to inspect HTTP(S) requests. When proxying HTTPS request to, for example, https://www.google.com I see requests being made to https://www.google.comhttps://www.google.com/. I suspect this is due to the headline, which is "GET https://google.com/ HTTP/1.1".

The following code causes the problem:

require "http"

HTTP.via("0.0.0.0", 8888).get "https://www.google.com", :ssl => { :verify_mode => OpenSSL::SSL::VERIFY_NONE }

When doing the same thing with a persistent connection to http://www.google.com (plain HTTP) everything works as expected. The headline is "GET / HTTP/1.1" in that case.

Is http doing the correct thing here? I've not had such issues with other ruby libraries when proxying HTTPS requests.

@tarcieri
Copy link
Member

@britishtea definitely seems like a bug, possibly related to Addressable?

@ixti
Copy link
Member

ixti commented Apr 11, 2016

@Connorhd fixed issue reported by @britishtea in 2625436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants