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

Domain names are preprended with '/' #107

Open
juliendangers opened this issue Dec 17, 2015 · 1 comment
Open

Domain names are preprended with '/' #107

juliendangers opened this issue Dec 17, 2015 · 1 comment

Comments

@juliendangers
Copy link

juliendangers commented Dec 17, 2015

Is it normal that urls without protocol (actually domain names) are preprended with '/' ?

I added the following test

"domain name" should "be parsed correctly" in {
  val uri = parse("mydomain.com")
  uri.toString should equal("mydomain.com")
}

and uri.toString = "/mydomain.com"

@theon
Copy link
Contributor

theon commented Dec 17, 2015

Hi @juliendangers,

scala-uri currently parses this as a path rather than a host, because it is a valid path. Example: https://who.is/whois/mydomain.com - this page could have a <a href="mydomain.com"> and browsers treat that as a path, not a host. For it to be treated as a host, you need to prepend with a scheme.

This all said, /path and path are different URIs, so it is a bug that the slash is prepended :)

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