Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Unified Diff: net/websockets/websocket.cc

Issue 1108002: Implement new websocket handshake based on draft-hixie-thewebsocketprotocol-76 (Closed)
Patch Set: fix for review comments Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/websockets/websocket.h ('k') | net/websockets/websocket_handshake.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « net/websockets/websocket.h ('k') | net/websockets/websocket_handshake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698