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

Side by Side Diff: jingle/glue/proxy_resolving_client_socket.cc

Issue 786503002: Fix for issue 439560: connect to TURN servers through proxies with auth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ammended patch set removing code rather than commenting it Created 6 years 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 | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "jingle/glue/proxy_resolving_client_socket.h" 5 #include "jingle/glue/proxy_resolving_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
13 #include "net/base/load_flags.h" 13 #include "net/base/load_flags.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/http/http_auth_controller.h" 15 #include "net/http/http_auth_controller.h"
16 #include "net/http/http_network_session.h" 16 #include "net/http/http_transaction_factory.h"
17 #include "net/http/proxy_client_socket.h" 17 #include "net/http/proxy_client_socket.h"
18 #include "net/socket/client_socket_handle.h" 18 #include "net/socket/client_socket_handle.h"
19 #include "net/socket/client_socket_pool_manager.h" 19 #include "net/socket/client_socket_pool_manager.h"
20 #include "net/url_request/url_request_context.h" 20 #include "net/url_request/url_request_context.h"
21 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
22 22
23 namespace jingle_glue { 23 namespace jingle_glue {
24 24
25 ProxyResolvingClientSocket::ProxyResolvingClientSocket( 25 ProxyResolvingClientSocket::ProxyResolvingClientSocket(
26 net::ClientSocketFactory* socket_factory, 26 net::ClientSocketFactory* socket_factory,
(...skipping 19 matching lines...) Expand all
46 net::NetLog::SOURCE_SOCKET)), 46 net::NetLog::SOURCE_SOCKET)),
47 weak_factory_(this) { 47 weak_factory_(this) {
48 DCHECK(request_context_getter.get()); 48 DCHECK(request_context_getter.get());
49 net::URLRequestContext* request_context = 49 net::URLRequestContext* request_context =
50 request_context_getter->GetURLRequestContext(); 50 request_context_getter->GetURLRequestContext();
51 DCHECK(request_context); 51 DCHECK(request_context);
52 DCHECK(!dest_host_port_pair_.host().empty()); 52 DCHECK(!dest_host_port_pair_.host().empty());
53 DCHECK_GT(dest_host_port_pair_.port(), 0); 53 DCHECK_GT(dest_host_port_pair_.port(), 0);
54 DCHECK(proxy_url_.is_valid()); 54 DCHECK(proxy_url_.is_valid());
55 55
56 net::HttpNetworkSession::Params session_params; 56 network_session_ = request_context->http_transaction_factory()->GetSession();
57 session_params.client_socket_factory = socket_factory;
58 session_params.host_resolver = request_context->host_resolver();
59 session_params.cert_verifier = request_context->cert_verifier();
60 session_params.transport_security_state =
61 request_context->transport_security_state();
62 // TODO(rkn): This is NULL because ChannelIDService is not thread safe.
63 session_params.channel_id_service = NULL;
64 session_params.proxy_service = request_context->proxy_service();
65 session_params.ssl_config_service = request_context->ssl_config_service();
66 session_params.http_auth_handler_factory =
67 request_context->http_auth_handler_factory();
68 session_params.network_delegate = request_context->network_delegate();
69 session_params.http_server_properties =
70 request_context->http_server_properties();
71 session_params.net_log = request_context->net_log();
72
73 const net::HttpNetworkSession::Params* reference_params =
74 request_context->GetNetworkSessionParams();
75 if (reference_params) {
76 // TODO(mmenke): Just copying specific parameters seems highly regression
77 // prone. Should have a better way to do this.
78 session_params.host_mapping_rules = reference_params->host_mapping_rules;
79 session_params.ignore_certificate_errors =
80 reference_params->ignore_certificate_errors;
81 session_params.testing_fixed_http_port =
82 reference_params->testing_fixed_http_port;
83 session_params.testing_fixed_https_port =
84 reference_params->testing_fixed_https_port;
85 session_params.next_protos = reference_params->next_protos;
86 session_params.trusted_spdy_proxy = reference_params->trusted_spdy_proxy;
87 session_params.force_spdy_over_ssl = reference_params->force_spdy_over_ssl;
88 session_params.force_spdy_always = reference_params->force_spdy_always;
89 session_params.forced_spdy_exclusions =
90 reference_params->forced_spdy_exclusions;
91 session_params.use_alternate_protocols =
92 reference_params->use_alternate_protocols;
93 }
94
95 network_session_ = new net::HttpNetworkSession(session_params);
96 } 57 }
97 58
98 ProxyResolvingClientSocket::~ProxyResolvingClientSocket() { 59 ProxyResolvingClientSocket::~ProxyResolvingClientSocket() {
99 Disconnect(); 60 Disconnect();
100 } 61 }
101 62
102 int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len, 63 int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len,
103 const net::CompletionCallback& callback) { 64 const net::CompletionCallback& callback) {
104 if (transport_.get() && transport_->socket()) 65 if (transport_.get() && transport_->socket())
105 return transport_->socket()->Read(buf, buf_len, callback); 66 return transport_->socket()->Read(buf, buf_len, callback);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return false; 371 return false;
411 } 372 }
412 373
413 void ProxyResolvingClientSocket::CloseTransportSocket() { 374 void ProxyResolvingClientSocket::CloseTransportSocket() {
414 if (transport_.get() && transport_->socket()) 375 if (transport_.get() && transport_->socket())
415 transport_->socket()->Disconnect(); 376 transport_->socket()->Disconnect();
416 transport_.reset(); 377 transport_.reset();
417 } 378 }
418 379
419 } // namespace jingle_glue 380 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698