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

Unified Diff: net/websockets/websocket_job.cc

Issue 10843050: WebSocket over SPDY: handshake support for both of SPDY/2 and SPDY/3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflects yutak's review Created 8 years, 4 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
Index: net/websockets/websocket_job.cc
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc
index 56faefb25037465445c69914ab51343d532ce436..545d893a4ad516e6dee66f727f7bc2fade444db1 100644
--- a/net/websockets/websocket_job.cc
+++ b/net/websockets/websocket_job.cc
@@ -80,6 +80,7 @@ WebSocketJob::WebSocketJob(SocketStream::Delegate* delegate)
started_to_send_handshake_request_(false),
handshake_request_sent_(0),
response_cookies_save_index_(0),
+ protocol_version_(0),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_send_pending_(this)) {
}
@@ -312,7 +313,9 @@ int WebSocketJob::OnReceivedSpdyResponseHeader(
if (status != OK)
return status;
// TODO(toyoshim): Fallback to non-spdy connection?
- handshake_response_->ParseResponseHeaderBlock(headers, challenge_);
+ handshake_response_->ParseResponseHeaderBlock(headers,
+ challenge_,
+ protocol_version_);
SaveCookiesAndNotifyHeaderComplete();
return OK;
@@ -389,7 +392,7 @@ void WebSocketJob::DoSendData() {
if (spdy_websocket_stream_.get()) {
scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock);
handshake_request_->GetRequestHeaderBlock(
- socket_->url(), headers.get(), &challenge_);
+ socket_->url(), headers.get(), &challenge_, protocol_version_);
spdy_websocket_stream_->SendRequest(headers.Pass());
} else {
const std::string& handshake_request =
@@ -567,6 +570,7 @@ int WebSocketJob::TrySpdyStream() {
return OK;
// Create SpdyWebSocketStream.
+ protocol_version_ = spdy_session->GetProtocolVersion();
spdy_websocket_stream_.reset(new SpdyWebSocketStream(spdy_session, this));
int result = spdy_websocket_stream_->InitializeStream(

Powered by Google App Engine
This is Rietveld 408576698