browserhtml icon indicating copy to clipboard operation
browserhtml copied to clipboard

Properly handle scheme-less host:port URLs in the location bar

Open tschneidereit opened this issue 9 years ago • 6 comments

Right now, localhost:6060 is interpreted as a URL with the scheme localhost, where it should be prefixed with http://. Unfortunately, doing this properly is far from trivial, just as the URL syntax. One thing we could probably get away with for now is to only identify a fixed set of schemes that we handle the current way: data:, javascript:, about: perhaps. blob: for example wouldn't be required because there's no way to navigate to a blob from outside a document anyway.

tschneidereit avatar Apr 13 '16 10:04 tschneidereit

I'd like to start working on this, assuming no one else is.

jdanford avatar Jun 03 '17 02:06 jdanford

What's the long-term plan for Servo handling external protocols like mailto: and webcal:?

jdanford avatar Jun 24 '17 16:06 jdanford

What's the long-term plan for Servo handling external protocols like mailto: and webcal:?

There's no fixed plan yet, but it's very likely that Servo will just provide support for registering protocol handlers in its embedding API and leave the rest up to the embedding.

tschneidereit avatar Jun 24 '17 16:06 tschneidereit

Okay, at that point the URL handling code will need to be integrated with other parts of the system, instead of relying on something like a simple regex. I'm not sure where to look in the Servo codebase to see which protocols it currently handles, so if you know then I'd be happy to take a look. In the meantime, does this list seem reasonable?

  • about:
  • data:
  • file:
  • http:
  • https:
  • javascript:

jdanford avatar Jun 24 '17 16:06 jdanford

Only protocol schemas that're used without // need to be special-cased. http:8080 should not be special-cased: AFAIK, http://http is a perfectly valid URL. That leaves about, data, and javascript. Also handling mailto probably makes sense because it's quite frequent. Not sure what we'd do with it right now, though - maybe just ignore it.

tschneidereit avatar Jun 24 '17 16:06 tschneidereit

http:8080 should not be special-cased

This is one of those cases where real-world behavior deviates from the spec – Firefox and Chrome both interpret URLs like http:8080 and file:/etc/hosts as if they had the usual //, so should Servo be stricter than existing browsers here?

jdanford avatar Jun 24 '17 17:06 jdanford