OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(ukai): code is similar with http_network_transaction.cc. We should | 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should |
6 // think about ways to share code, if possible. | 6 // think about ways to share code, if possible. |
7 | 7 |
8 #include "net/socket_stream/socket_stream.h" | 8 #include "net/socket_stream/socket_stream.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 void SocketStream::SetUserData(const void* key, UserData* data) { | 127 void SocketStream::SetUserData(const void* key, UserData* data) { |
128 user_data_[key] = linked_ptr<UserData>(data); | 128 user_data_[key] = linked_ptr<UserData>(data); |
129 } | 129 } |
130 | 130 |
131 bool SocketStream::is_secure() const { | 131 bool SocketStream::is_secure() const { |
132 return url_.SchemeIs("wss"); | 132 return url_.SchemeIs("wss"); |
133 } | 133 } |
134 | 134 |
| 135 GURL SocketStream::GetURLForCookies(const GURL& url) { |
| 136 std::string scheme = url.SchemeIs("wss") ? "https" : "http"; |
| 137 url_canon::Replacements<char> replacements; |
| 138 replacements.SetScheme(scheme.c_str(), |
| 139 url_parse::Component(0, scheme.length())); |
| 140 return url.ReplaceComponents(replacements); |
| 141 } |
| 142 |
135 void SocketStream::set_context(URLRequestContext* context) { | 143 void SocketStream::set_context(URLRequestContext* context) { |
136 const URLRequestContext* prev_context = context_; | 144 const URLRequestContext* prev_context = context_; |
137 | 145 |
138 context_ = context; | 146 context_ = context; |
139 | 147 |
140 if (prev_context != context) { | 148 if (prev_context != context) { |
141 if (prev_context && pac_request_) { | 149 if (prev_context && pac_request_) { |
142 prev_context->proxy_service()->CancelPacRequest(pac_request_); | 150 prev_context->proxy_service()->CancelPacRequest(pac_request_); |
143 pac_request_ = NULL; | 151 pac_request_ = NULL; |
144 } | 152 } |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 return OK; | 1328 return OK; |
1321 } | 1329 } |
1322 | 1330 |
1323 if (!delegate_) | 1331 if (!delegate_) |
1324 return result; | 1332 return result; |
1325 | 1333 |
1326 SSLInfo ssl_info; | 1334 SSLInfo ssl_info; |
1327 ssl_socket->GetSSLInfo(&ssl_info); | 1335 ssl_socket->GetSSLInfo(&ssl_info); |
1328 | 1336 |
1329 TransportSecurityState::DomainState domain_state; | 1337 TransportSecurityState::DomainState domain_state; |
1330 const bool fatal = context_->transport_security_state() && | 1338 const bool fatal = |
1331 context_->transport_security_state()->GetDomainState(url_.host(), | 1339 context_->transport_security_state() && |
| 1340 context_->transport_security_state()->GetDomainState( |
| 1341 url_.host(), |
1332 SSLConfigService::IsSNIAvailable(context_->ssl_config_service()), | 1342 SSLConfigService::IsSNIAvailable(context_->ssl_config_service()), |
| 1343 delegate_->CanGetCookies(this, url_for_cookies()), |
1333 &domain_state) && | 1344 &domain_state) && |
1334 domain_state.ShouldSSLErrorsBeFatal(); | 1345 domain_state.ShouldSSLErrorsBeFatal(); |
1335 | 1346 |
1336 delegate_->OnSSLCertificateError(this, ssl_info, fatal); | 1347 delegate_->OnSSLCertificateError(this, ssl_info, fatal); |
1337 return ERR_IO_PENDING; | 1348 return ERR_IO_PENDING; |
1338 } | 1349 } |
1339 | 1350 |
1340 } // namespace net | 1351 } // namespace net |
OLD | NEW |