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

Triple slashes #138

Open
kaldown opened this issue Mar 18, 2021 · 1 comment
Open

Triple slashes #138

kaldown opened this issue Mar 18, 2021 · 1 comment

Comments

@kaldown
Copy link

kaldown commented Mar 18, 2021

Although it is okay, still looks weird:

>>> f = furl('staging.s3-website.us-east-1.amazonaws.com')
>>> f.scheme = 'http'
>>> f.url
'http:///staging.s3-website.us-east-1.amazonaws.com'

Why is there triple slashes?

Additional:

>>> f = furl('http://staging.s3-website.us-east-1.amazonaws.com')
>>> f.url
'http://staging.s3-website.us-east-1.amazonaws.com'

But:

>>> f = furl('staging.s3-website.us-east-1.amazonaws.com')
>>> f.scheme = 'http://'  # yes, it's not a proper way, but still confusing how parser works
'http://:staging.s3-website.us-east-1.amazonaws.com'

I'm confused.

@gruns
Copy link
Owner

gruns commented Mar 18, 2021

see #110 and #103

in short, furl doesn't know whether to treat staging.s3-website.us-east-1.amazonaws.com as a path or a domain, as it can be both. so, to be unambiguous, it treats it as a path, resulting in 'http:///staging.s3-website.us-east-1.amazonaws.com' (with an empty host)

until furl knows the public suffix list (something i started working on but have yet to finish), you can avoid this by explicitly setting 'staging.s3-website.us-east-1.amazonaws.com' as the host, eg

>>> f = furl().set(host='staging.s3-website.us-east-1.amazonaws.com')
>>> f.url
'//staging.s3-website.us-east-1.amazonaws.com'

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

No branches or pull requests

2 participants