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

Side by Side Diff: net/websockets/websocket_stream.cc

Issue 1153763002: Hardening the 'url::Origin' implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More. Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request.cc ('k') | url/origin.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_stream.h" 5 #include "net/websockets/websocket_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 scoped_ptr<WebSocketHandshakeStreamCreateHelper> create_helper) 87 scoped_ptr<WebSocketHandshakeStreamCreateHelper> create_helper)
88 : delegate_(new Delegate(this)), 88 : delegate_(new Delegate(this)),
89 url_request_( 89 url_request_(
90 context->CreateRequest(url, DEFAULT_PRIORITY, delegate_.get())), 90 context->CreateRequest(url, DEFAULT_PRIORITY, delegate_.get())),
91 connect_delegate_(connect_delegate.Pass()), 91 connect_delegate_(connect_delegate.Pass()),
92 create_helper_(create_helper.release()) { 92 create_helper_(create_helper.release()) {
93 create_helper_->set_failure_message(&failure_message_); 93 create_helper_->set_failure_message(&failure_message_);
94 HttpRequestHeaders headers; 94 HttpRequestHeaders headers;
95 headers.SetHeader(websockets::kUpgrade, websockets::kWebSocketLowercase); 95 headers.SetHeader(websockets::kUpgrade, websockets::kWebSocketLowercase);
96 headers.SetHeader(HttpRequestHeaders::kConnection, websockets::kUpgrade); 96 headers.SetHeader(HttpRequestHeaders::kConnection, websockets::kUpgrade);
97 headers.SetHeader(HttpRequestHeaders::kOrigin, origin.string()); 97 headers.SetHeader(HttpRequestHeaders::kOrigin, origin.serialize());
98 headers.SetHeader(websockets::kSecWebSocketVersion, 98 headers.SetHeader(websockets::kSecWebSocketVersion,
99 websockets::kSupportedVersion); 99 websockets::kSupportedVersion);
100 url_request_->SetExtraRequestHeaders(headers); 100 url_request_->SetExtraRequestHeaders(headers);
101 101
102 // This passes the ownership of |create_helper_| to |url_request_|. 102 // This passes the ownership of |create_helper_| to |url_request_|.
103 url_request_->SetUserData( 103 url_request_->SetUserData(
104 WebSocketHandshakeStreamBase::CreateHelper::DataKey(), 104 WebSocketHandshakeStreamBase::CreateHelper::DataKey(),
105 create_helper_); 105 create_helper_);
106 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE); 106 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE);
107 } 107 }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 connect_delegate->OnFinishOpeningHandshake(make_scoped_ptr( 375 connect_delegate->OnFinishOpeningHandshake(make_scoped_ptr(
376 new WebSocketHandshakeResponseInfo(url, 376 new WebSocketHandshakeResponseInfo(url,
377 headers->response_code(), 377 headers->response_code(),
378 headers->GetStatusText(), 378 headers->GetStatusText(),
379 headers, 379 headers,
380 response_time))); 380 response_time)));
381 } 381 }
382 } 382 }
383 383
384 } // namespace net 384 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | url/origin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698