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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 replacements.SetHostStr(destination.host()); | 856 replacements.SetHostStr(destination.host()); |
857 const std::string new_port = base::UintToString(destination.port()); | 857 const std::string new_port = base::UintToString(destination.port()); |
858 replacements.SetPortStr(new_port); | 858 replacements.SetPortStr(new_port); |
859 replacements.ClearUsername(); | 859 replacements.ClearUsername(); |
860 replacements.ClearPassword(); | 860 replacements.ClearPassword(); |
861 replacements.ClearPath(); | 861 replacements.ClearPath(); |
862 replacements.ClearQuery(); | 862 replacements.ClearQuery(); |
863 replacements.ClearRef(); | 863 replacements.ClearRef(); |
864 url = url.ReplaceComponents(replacements); | 864 url = url.ReplaceComponents(replacements); |
865 | 865 |
866 if (session_->quic_stream_factory()->IsQuicDisabled()) | 866 // If QUIC is disabled on the destination port, return error. |
| 867 if (session_->quic_stream_factory()->IsQuicDisabled(destination.port())) |
867 return ERR_QUIC_PROTOCOL_ERROR; | 868 return ERR_QUIC_PROTOCOL_ERROR; |
868 } else { | 869 } else { |
869 DCHECK(using_ssl_); | 870 DCHECK(using_ssl_); |
870 // The certificate of a QUIC alternative server is expected to be valid | 871 // The certificate of a QUIC alternative server is expected to be valid |
871 // for the origin of the request (in addition to being valid for the | 872 // for the origin of the request (in addition to being valid for the |
872 // server itself). | 873 // server itself). |
873 destination = destination_; | 874 destination = destination_; |
874 ssl_config = &server_ssl_config_; | 875 ssl_config = &server_ssl_config_; |
875 } | 876 } |
876 int rv = | 877 int rv = |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 using_spdy_ = true; | 986 using_spdy_ = true; |
986 next_state_ = STATE_CREATE_STREAM; | 987 next_state_ = STATE_CREATE_STREAM; |
987 } else { | 988 } else { |
988 // It is possible that the spdy session no longer exists. | 989 // It is possible that the spdy session no longer exists. |
989 ReturnToStateInitConnection(true /* close connection */); | 990 ReturnToStateInitConnection(true /* close connection */); |
990 } | 991 } |
991 return OK; | 992 return OK; |
992 } | 993 } |
993 | 994 |
994 if (proxy_info_.is_quic() && using_quic_) { | 995 if (proxy_info_.is_quic() && using_quic_) { |
995 // Mark QUIC proxy as bad if QUIC got disabled. | 996 // Mark QUIC proxy as bad if QUIC got disabled on the destination port. |
996 // Underlying QUIC layer would have closed the connection. | 997 // Underlying QUIC layer would have closed the connection. |
997 HostPortPair destination = proxy_info_.proxy_server().host_port_pair(); | 998 HostPortPair destination = proxy_info_.proxy_server().host_port_pair(); |
998 if (session_->quic_stream_factory()->IsQuicDisabled()) { | 999 if (session_->quic_stream_factory()->IsQuicDisabled(destination.port())) { |
999 using_quic_ = false; | 1000 using_quic_ = false; |
1000 return ReconsiderProxyAfterError(ERR_QUIC_PROTOCOL_ERROR); | 1001 return ReconsiderProxyAfterError(ERR_QUIC_PROTOCOL_ERROR); |
1001 } | 1002 } |
1002 } | 1003 } |
1003 | 1004 |
1004 // |result| may be the result of any of the stacked pools. The following | 1005 // |result| may be the result of any of the stacked pools. The following |
1005 // logic is used when determining how to interpret an error. | 1006 // logic is used when determining how to interpret an error. |
1006 // If |result| < 0: | 1007 // If |result| < 0: |
1007 // and connection_->socket() != NULL, then the SSL handshake ran and it | 1008 // and connection_->socket() != NULL, then the SSL handshake ran and it |
1008 // is a potentially recoverable error. | 1009 // is a potentially recoverable error. |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 | 1626 |
1626 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1627 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1627 if (connection_->socket()) { | 1628 if (connection_->socket()) { |
1628 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1629 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1629 } | 1630 } |
1630 | 1631 |
1631 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1632 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1632 } | 1633 } |
1633 | 1634 |
1634 } // namespace net | 1635 } // namespace net |
OLD | NEW |