OLD | NEW |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 headers.SetHeader(HttpRequestHeaders::kConnection, websockets::kUpgrade); | 104 headers.SetHeader(HttpRequestHeaders::kConnection, websockets::kUpgrade); |
105 headers.SetHeader(HttpRequestHeaders::kOrigin, origin.string()); | 105 headers.SetHeader(HttpRequestHeaders::kOrigin, origin.string()); |
106 headers.SetHeader(websockets::kSecWebSocketVersion, | 106 headers.SetHeader(websockets::kSecWebSocketVersion, |
107 websockets::kSupportedVersion); | 107 websockets::kSupportedVersion); |
108 url_request_->SetExtraRequestHeaders(headers); | 108 url_request_->SetExtraRequestHeaders(headers); |
109 | 109 |
110 // This passes the ownership of |create_helper_| to |url_request_|. | 110 // This passes the ownership of |create_helper_| to |url_request_|. |
111 url_request_->SetUserData( | 111 url_request_->SetUserData( |
112 WebSocketHandshakeStreamBase::CreateHelper::DataKey(), | 112 WebSocketHandshakeStreamBase::CreateHelper::DataKey(), |
113 create_helper_); | 113 create_helper_); |
114 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | | 114 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE); |
115 LOAD_BYPASS_CACHE | | |
116 LOAD_DO_NOT_PROMPT_FOR_LOGIN); | |
117 } | 115 } |
118 | 116 |
119 // Destroying this object destroys the URLRequest, which cancels the request | 117 // Destroying this object destroys the URLRequest, which cancels the request |
120 // and so terminates the handshake if it is incomplete. | 118 // and so terminates the handshake if it is incomplete. |
121 ~StreamRequestImpl() override {} | 119 ~StreamRequestImpl() override {} |
122 | 120 |
123 void Start(scoped_ptr<base::Timer> timer) { | 121 void Start(scoped_ptr<base::Timer> timer) { |
124 DCHECK(timer); | 122 DCHECK(timer); |
125 TimeDelta timeout(TimeDelta::FromSeconds( | 123 TimeDelta timeout(TimeDelta::FromSeconds( |
126 kHandshakeTimeoutIntervalInSeconds)); | 124 kHandshakeTimeoutIntervalInSeconds)); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 connect_delegate->OnFinishOpeningHandshake(make_scoped_ptr( | 350 connect_delegate->OnFinishOpeningHandshake(make_scoped_ptr( |
353 new WebSocketHandshakeResponseInfo(url, | 351 new WebSocketHandshakeResponseInfo(url, |
354 headers->response_code(), | 352 headers->response_code(), |
355 headers->GetStatusText(), | 353 headers->GetStatusText(), |
356 headers, | 354 headers, |
357 response_time))); | 355 response_time))); |
358 } | 356 } |
359 } | 357 } |
360 | 358 |
361 } // namespace net | 359 } // namespace net |
OLD | NEW |