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

Inconsistent Addressable::URI#heuristic_parse behavior with schemaless URLs #265

Open
dwbutler opened this issue Aug 1, 2017 · 3 comments
Labels

Comments

@dwbutler
Copy link

dwbutler commented Aug 1, 2017

I would expect Addressable::URI#heuristic_parse to give the same results for the completely schemaless test.com and the protocol-relative schemaless url //test.com

Expected:

uri = Addressable::URI.heuristic_parse("//test.com")
uri.scheme
=> "http"
uri.relative?
=> false

Actual:

uri = Addressable::URI.heuristic_parse("//test.com")
uri.scheme
=> nil
uri.relative?
=> true
@sporkmonger
Copy link
Owner

Good point. I agree.

@dentarg
Copy link
Collaborator

dentarg commented Jan 15, 2022

From #401 (comment)

I think it's worth calling out that Addressable's heuristic_parse does aim to hew quite closely to whatever browsers are doing in the address bar.

If I enter //test.com in Google Chrome it tries to visit file:///test.com. Firefox tries to visit file:////test.com. Safari does a Google search for //test.com 😅

@dentarg
Copy link
Collaborator

dentarg commented Jul 19, 2023

Related to #356

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

No branches or pull requests

3 participants