Bug 42636
| Summary: | WebSocket() constructor should throw SYNTAX_ERR if URL has zero or one slash after 'ws:' or 'wss:' | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Simon Pieters (:zcorpan) <zcorpan> |
| Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
| Status: | VERIFIED INVALID | ||
| Severity: | Normal | CC: | ap, bfulgham, joenotcharles, ukai |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
Simon Pieters (:zcorpan)
WebKit implies the slashes if they're missing in WebSocket URLs.
new WebSocket('ws:example.org/');
new WebSocket('ws:/example.org/');
Apparently no slashes means no authority (user/pass+host+port), which doesn't
make sense for websocket, and websocket requires an absolute URL. So I think
the above cases should throw SYNTAX_ERR.
Also see https://bugzilla.mozilla.org/show_bug.cgi?id=580234
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Mozilla folks seem to disagree that this is a bug, and I think they are right.
Alexey Proskuryakov
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10213
Brent Fulgham
Since Mozilla and Alexey think current behavior is correct, closing this.
Simon Pieters (:zcorpan)
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17772#c5
e.g. for ws:example.org/ (no base url)
https://url.spec.whatwg.org/#scheme-state
"Otherwise, if url is special, set state to special authority slashes state."
->
https://url.spec.whatwg.org/#special-authority-slashes-state
"Otherwise, syntax violation, set state to special authority ignore slashes state, and decrease pointer by one."
->
https://url.spec.whatwg.org/#special-authority-ignore-slashes-state
"If c is neither "/" nor "\", set state to authority state, and decrease pointer by one."
->
https://url.spec.whatwg.org/#authority-state
"Otherwise, append c to buffer."
...etc; it will parse successfully and up with the same URL record as for ws://example.org/
Simon Pieters (:zcorpan)
w-p-t test at
http://w3c-test.org/websockets/constructor/017.html