diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-19 21:08:09 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-19 21:08:09 +0530 |
commit | 6663f28f0de308c9365b360cd8ad9ee9e43127ee (patch) | |
tree | 184ee22c9561ce7fd6a62ef6552f8a986f4ba1e7 /components/net_traits/lib.rs | |
parent | 77d3fbcca3c6f7e8b4068f89e25b090977fe5672 (diff) | |
parent | 482d23bb19568b8a46d83a1c6e8ffb5612a7e605 (diff) | |
download | servo-6663f28f0de308c9365b360cd8ad9ee9e43127ee.tar.gz servo-6663f28f0de308c9365b360cd8ad9ee9e43127ee.zip |
Auto merge of #9358 - jsanders:refactor-websocket-closing, r=jdm
Clean up websocket closing code
Fixes #7860.
This also changes quite a bit about how close codes are implemented, I believe bringing them closer in line with the spec. Instead of saving off the close code sent by the client, it uses the code from the server's closing handshake. It also handles `NO_STATUS` in what I believe is the correct manner. Making this work required a change to the test harness to make the `/echo` websocket handler echo the code sent by the client and handle `NO_STATUS` properly, rather than always replying with `NORMAL`.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9358)
<!-- Reviewable:end -->
Diffstat (limited to 'components/net_traits/lib.rs')
-rw-r--r-- | components/net_traits/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 5830f115514..654a64e811c 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -178,14 +178,15 @@ pub enum MessageData { #[derive(Deserialize, Serialize)] pub enum WebSocketDomAction { SendMessage(MessageData), - Close(u16, String), + Close(Option<u16>, Option<String>), } #[derive(Deserialize, Serialize)] pub enum WebSocketNetworkEvent { ConnectionEstablished(header::Headers, Vec<String>), MessageReceived(MessageData), - Close, + Close(Option<u16>, String), + Fail, } #[derive(Deserialize, Serialize)] |