mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Send reason in the Websocket close handshake
This commit is contained in:
parent
7debfd1f4c
commit
61fa1e4440
1 changed files with 4 additions and 1 deletions
|
@ -40,6 +40,7 @@ use websocket::client::receiver::Receiver;
|
|||
use websocket::client::request::Url;
|
||||
use websocket::client::sender::Sender;
|
||||
use websocket::header::Origin;
|
||||
use websocket::message::CloseData;
|
||||
use websocket::result::WebSocketResult;
|
||||
use websocket::stream::WebSocketStream;
|
||||
use websocket::ws::receiver::Receiver as WSReceiver;
|
||||
|
@ -292,7 +293,9 @@ impl WebSocketMethods for WebSocket {
|
|||
let mut sender = this.sender.borrow_mut();
|
||||
//TODO: Also check if the buffer is full
|
||||
if let Some(sender) = sender.as_mut() {
|
||||
let _ = sender.lock().unwrap().send_message(Message::Close(None));
|
||||
let code: u16 = this.code.get();
|
||||
let reason = this.reason.borrow().clone();
|
||||
let _ = sender.lock().unwrap().send_message(Message::Close(Some(CloseData::new(code, reason))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue