OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
| 11 #include <memory> |
| 12 |
11 #include "webrtc/base/autodetectproxy.h" | 13 #include "webrtc/base/autodetectproxy.h" |
12 #include "webrtc/base/httpcommon.h" | 14 #include "webrtc/base/httpcommon.h" |
13 #include "webrtc/base/httpcommon-inl.h" | 15 #include "webrtc/base/httpcommon-inl.h" |
14 #include "webrtc/base/scoped_ptr.h" | |
15 #include "webrtc/base/socketadapters.h" | 16 #include "webrtc/base/socketadapters.h" |
16 #include "webrtc/base/ssladapter.h" | 17 #include "webrtc/base/ssladapter.h" |
17 #include "webrtc/base/sslsocketfactory.h" | 18 #include "webrtc/base/sslsocketfactory.h" |
18 | 19 |
19 namespace rtc { | 20 namespace rtc { |
20 | 21 |
21 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
22 // ProxySocketAdapter | 23 // ProxySocketAdapter |
23 // TODO: Consider combining AutoDetectProxy and ProxySocketAdapter. I think | 24 // TODO: Consider combining AutoDetectProxy and ProxySocketAdapter. I think |
24 // the socket adapter is the more appropriate idiom for automatic proxy | 25 // the socket adapter is the more appropriate idiom for automatic proxy |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 proxy_socket = http_proxy; | 161 proxy_socket = http_proxy; |
161 } | 162 } |
162 if (!proxy_socket) { | 163 if (!proxy_socket) { |
163 delete socket; | 164 delete socket; |
164 return NULL; | 165 return NULL; |
165 } | 166 } |
166 socket = proxy_socket; // for our purposes the proxy is now the socket | 167 socket = proxy_socket; // for our purposes the proxy is now the socket |
167 } | 168 } |
168 | 169 |
169 if (!hostname_.empty()) { | 170 if (!hostname_.empty()) { |
170 rtc::scoped_ptr<SSLAdapter> ssl_adapter(SSLAdapter::Create(socket)); | 171 std::unique_ptr<SSLAdapter> ssl_adapter(SSLAdapter::Create(socket)); |
171 if (!ssl_adapter) { | 172 if (!ssl_adapter) { |
172 LOG_F(LS_ERROR) << "SSL unavailable"; | 173 LOG_F(LS_ERROR) << "SSL unavailable"; |
173 delete socket; | 174 delete socket; |
174 return NULL; | 175 return NULL; |
175 } | 176 } |
176 | 177 |
177 ssl_adapter->set_ignore_bad_cert(ignore_bad_cert_); | 178 ssl_adapter->set_ignore_bad_cert(ignore_bad_cert_); |
178 if (ssl_adapter->StartSSL(hostname_.c_str(), true) != 0) { | 179 if (ssl_adapter->StartSSL(hostname_.c_str(), true) != 0) { |
179 LOG_F(LS_ERROR) << "SSL failed to start."; | 180 LOG_F(LS_ERROR) << "SSL failed to start."; |
180 return NULL; | 181 return NULL; |
181 } | 182 } |
182 socket = ssl_adapter.release(); | 183 socket = ssl_adapter.release(); |
183 } | 184 } |
184 | 185 |
185 // Regular logging occurs at the highest level | 186 // Regular logging occurs at the highest level |
186 if (!logging_label_.empty() && !binary_mode_) { | 187 if (!logging_label_.empty() && !binary_mode_) { |
187 socket = new LoggingSocketAdapter(socket, logging_level_, | 188 socket = new LoggingSocketAdapter(socket, logging_level_, |
188 logging_label_.c_str(), binary_mode_); | 189 logging_label_.c_str(), binary_mode_); |
189 } | 190 } |
190 return socket; | 191 return socket; |
191 } | 192 } |
192 | 193 |
193 /////////////////////////////////////////////////////////////////////////////// | 194 /////////////////////////////////////////////////////////////////////////////// |
194 | 195 |
195 } // namespace rtc | 196 } // namespace rtc |
OLD | NEW |