Index: net/websockets/websocket.cc |
diff --git a/net/websockets/websocket.cc b/net/websockets/websocket.cc |
index dc4f5684e6a262911f0400b19f35eb7716c1ffb3..1cc3cf95a04a6ce0c3208cf4ee3cfda0bb18aed5 100644 |
--- a/net/websockets/websocket.cc |
+++ b/net/websockets/websocket.cc |
@@ -9,6 +9,7 @@ |
#include "base/message_loop.h" |
#include "net/websockets/websocket_handshake.h" |
+#include "net/websockets/websocket_handshake_draft75.h" |
namespace net { |
@@ -101,9 +102,20 @@ void WebSocket::OnConnected(SocketStream* socket_stream, |
DCHECK(!current_write_buf_); |
DCHECK(!handshake_.get()); |
- handshake_.reset(new WebSocketHandshake( |
- request_->url(), request_->origin(), request_->location(), |
- request_->protocol())); |
+ switch (request_->version()) { |
+ case DEFAULT_VERSION: |
+ handshake_.reset(new WebSocketHandshake( |
+ request_->url(), request_->origin(), request_->location(), |
+ request_->protocol())); |
+ break; |
+ case DRAFT75: |
+ handshake_.reset(new WebSocketHandshakeDraft75( |
+ request_->url(), request_->origin(), request_->location(), |
+ request_->protocol())); |
+ break; |
+ default: |
+ NOTREACHED() << "Unexpected protocol version:" << request_->version(); |
+ } |
const std::string msg = handshake_->CreateClientHandshakeMessage(); |
IOBufferWithSize* buf = new IOBufferWithSize(msg.size()); |