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 #include "net/socket_stream/socket_stream_job.h" | 5 #include "net/socket_stream/socket_stream_job.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "net/http/transport_security_state.h" | 8 #include "net/http/transport_security_state.h" |
9 #include "net/socket_stream/socket_stream_job_manager.h" | 9 #include "net/socket_stream/socket_stream_job_manager.h" |
10 #include "net/ssl/ssl_config_service.h" | 10 #include "net/ssl/ssl_config_service.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 SocketStream::Delegate* delegate, | 25 SocketStream::Delegate* delegate, |
26 TransportSecurityState* sts, | 26 TransportSecurityState* sts, |
27 SSLConfigService* ssl, | 27 SSLConfigService* ssl, |
28 URLRequestContext* context, | 28 URLRequestContext* context, |
29 CookieStore* cookie_store) { | 29 CookieStore* cookie_store) { |
30 GURL socket_url(url); | 30 GURL socket_url(url); |
31 TransportSecurityState::DomainState domain_state; | 31 TransportSecurityState::DomainState domain_state; |
32 if (url.scheme() == "ws" && sts && sts->GetDomainState( | 32 if (url.scheme() == "ws" && sts && sts->GetDomainState( |
33 url.host(), SSLConfigService::IsSNIAvailable(ssl), &domain_state) && | 33 url.host(), SSLConfigService::IsSNIAvailable(ssl), &domain_state) && |
34 domain_state.ShouldUpgradeToSSL()) { | 34 domain_state.ShouldUpgradeToSSL()) { |
35 url_canon::Replacements<char> replacements; | 35 url::Replacements<char> replacements; |
36 static const char kNewScheme[] = "wss"; | 36 static const char kNewScheme[] = "wss"; |
37 replacements.SetScheme(kNewScheme, | 37 replacements.SetScheme(kNewScheme, url::Component(0, strlen(kNewScheme))); |
38 url_parse::Component(0, strlen(kNewScheme))); | |
39 socket_url = url.ReplaceComponents(replacements); | 38 socket_url = url.ReplaceComponents(replacements); |
40 } | 39 } |
41 return SocketStreamJobManager::GetInstance()->CreateJob( | 40 return SocketStreamJobManager::GetInstance()->CreateJob( |
42 socket_url, delegate, context, cookie_store); | 41 socket_url, delegate, context, cookie_store); |
43 } | 42 } |
44 | 43 |
45 SocketStreamJob::SocketStreamJob() {} | 44 SocketStreamJob::SocketStreamJob() {} |
46 | 45 |
47 SocketStream::UserData* SocketStreamJob::GetUserData(const void* key) const { | 46 SocketStream::UserData* SocketStreamJob::GetUserData(const void* key) const { |
48 return socket_->GetUserData(key); | 47 return socket_->GetUserData(key); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 85 } |
87 | 86 |
88 void SocketStreamJob::DetachContext() { | 87 void SocketStreamJob::DetachContext() { |
89 if (socket_.get()) | 88 if (socket_.get()) |
90 socket_->DetachContext(); | 89 socket_->DetachContext(); |
91 } | 90 } |
92 | 91 |
93 SocketStreamJob::~SocketStreamJob() {} | 92 SocketStreamJob::~SocketStreamJob() {} |
94 | 93 |
95 } // namespace net | 94 } // namespace net |
OLD | NEW |