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/http/http_stream_factory_impl_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 DCHECK(!pac_request_); | 698 DCHECK(!pac_request_); |
699 DCHECK(session_); | 699 DCHECK(session_); |
700 | 700 |
701 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 701 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
702 | 702 |
703 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { | 703 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { |
704 proxy_info_.UseDirect(); | 704 proxy_info_.UseDirect(); |
705 return OK; | 705 return OK; |
706 } | 706 } |
707 | 707 |
708 // TODO(rch): remove this code since Alt-Svc seems to prohibit it. | |
709 GURL url_for_proxy = origin_url_; | |
710 // For SPDY via Alt-Svc, set |alternative_service_url_| to | |
711 // https://<alternative host>:<alternative port>/... | |
712 // so the proxy resolution works with the actual destination, and so | |
713 // that the correct socket pool is used. | |
714 if (IsSpdyAlternative()) { | |
715 // TODO(rch): Figure out how to make QUIC iteract with PAC | |
716 // scripts. By not re-writing the URL, we will query the PAC script | |
717 // for the proxy to use to reach the original URL via TCP. But | |
718 // the alternate request will be going via UDP to a different port. | |
719 GURL::Replacements replacements; | |
720 // new_port needs to be in scope here because GURL::Replacements references | |
721 // the memory contained by it directly. | |
722 const std::string new_port = base::UintToString(alternative_service_.port); | |
723 replacements.SetSchemeStr("https"); | |
724 replacements.SetPortStr(new_port); | |
725 url_for_proxy = url_for_proxy.ReplaceComponents(replacements); | |
726 } | |
727 | |
728 return session_->proxy_service()->ResolveProxy( | 708 return session_->proxy_service()->ResolveProxy( |
729 url_for_proxy, request_info_.method, &proxy_info_, io_callback_, | 709 origin_url_, request_info_.method, &proxy_info_, io_callback_, |
730 &pac_request_, session_->params().proxy_delegate, net_log_); | 710 &pac_request_, session_->params().proxy_delegate, net_log_); |
731 } | 711 } |
732 | 712 |
733 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 713 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
734 pac_request_ = NULL; | 714 pac_request_ = NULL; |
735 | 715 |
736 if (result == OK) { | 716 if (result == OK) { |
737 // Remove unsupported proxies from the list. | 717 // Remove unsupported proxies from the list. |
738 int supported_proxies = | 718 int supported_proxies = |
739 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | | 719 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 | 1534 |
1555 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1535 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1556 if (connection_->socket()) { | 1536 if (connection_->socket()) { |
1557 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1537 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1558 } | 1538 } |
1559 | 1539 |
1560 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1540 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1561 } | 1541 } |
1562 | 1542 |
1563 } // namespace net | 1543 } // namespace net |
OLD | NEW |