URL.host does not work correctly for custom protocol URLs
Categories
(Core :: Networking, defect, P3)
Tracking
()
People
(Reporter: emk, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: parity-edge, Whiteboard: [necko-backlog])
Updated•8 years ago
|
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Updated•2 years ago
|
Comment 4•2 years ago
|
||
This works in Node.js 18, that follow the same spec (https://url.spec.whatwg.org/)
var url = new URL("scheme://test/bla/stuff?query#ref");
undefined
url.host
'test'
I know that Chrome/Edge has the same behavior. I don't know if Node.js has it right or not.
But parsing other things is crucial for some applications, like parsing RTSP url which are clearly defined. Relying on https://github.com/unshiftio/url-parse is completely discouraged, but I have no other solution for having the host/hostname of rtsp://192.168.0.1/path/1 for now.
Comment 5•2 years ago
|
||
This seems to be a very long standing bug. See https://bugs.chromium.org/p/chromium/issues/detail?id=869291 that references https://bugs.chromium.org/p/chromium/issues/detail?id=660384 as parent.
An actual test page for this use case (with scheme://) can be see on https://jsdom.github.io/whatwg-url/#url=&base=c2NoZW1lOi8vdGVzdC9ibGEvc3R1ZmY/cXVlcnkjcmVm
More troubling is that some non-special protocols are recognized, such as ssh:// (Firefox only) https://jsdom.github.io/whatwg-url/#url=&base=c3NoOi8vZXhhbXBsZS5jb20vcGF0aA==
For now, I rely on the implementation in https://github.com/jsdom/whatwg-url The package is quite small, and URL really works.
Updated•1 year ago
|
Comment 8•10 months ago
|
||
Fixed by bug 1603699.
Description
•