Repository navigation
Update WebSocket blocked ports to match the Fetch spec - #10014
Conversation
|
Since the fetch code isn't used yet, this PR effectively removes the restrictions from WebSocket. I don't think we should attempt to fix #9950 right now. My apologies for not making this clear in the issue. (In either case, I would have asked to fix the two issues in separate commits.) |
|
|
||
| if BLOCKED_PORTS_LIST.iter().any(|&p| p == port) { | ||
| return Err(Error::Security); | ||
| } |
There was a problem hiding this comment.
In other words, this piece of code should not be deleted.
|
@KiChjang Should I write a test which checks if the websocket constructor throws a security error if a bad port is detected? |
|
tests/wpt/web-platform-tests/websockets/Create-Secure-blocked-port.htm already exists that does that. |
|
@Ms2ger Are there any other additional tests that you wish to have? |
|
I think this can merge as-is. We can write different tests when we get the fetch integration. |
|
It would be nice to update |
|
I've added testing for all the blocked ports. |
| 6668, // irc (alternate) | ||
| 6669, // irc (alternate) | ||
| ]; | ||
| for (var i = 0; i < BLOCKED_PORTS_LIST.length; i++) { |
There was a problem hiding this comment.
Not a huge issue, but I think you can do something like for (var port in BLOCKED_PORTS_LIST) in ES6.
|
@bors-servo r+ Thanks for working on this! |
|
📌 Commit 4ddf4e7 has been approved by |
Update WebSocket blocked ports to match the Fetch spec Adresses #9949. This adds a function that tests whether a request should be blocked or not based on it's url's scheme and port. It also adds testing for port restriction to the `main_fetch` method. More info in whatwg/fetch@eb07418. @Ms2ger In whatwg/html#841, @annevk proposes to remove port restrictions from websockets. Should we go ahead do that, given that the spec hasn't been changed yet? <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10014) <!-- Reviewable:end -->
|
☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor |
Adresses #9949.
This adds a function that tests whether a request should be blocked or not based on it's url's scheme and port. It also adds testing for port restriction to the
main_fetchmethod. More info in whatwg/fetch@eb07418.@Ms2ger In whatwg/html#841, @annevk proposes to remove port restrictions from websockets. Should we go ahead do that, given that the spec hasn't been changed yet?
This change is