| 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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 return ERR_QUIC_PROTOCOL_ERROR; | 999 return ERR_QUIC_PROTOCOL_ERROR; |
| 1000 } else { | 1000 } else { |
| 1001 DCHECK(using_ssl_); | 1001 DCHECK(using_ssl_); |
| 1002 // The certificate of a QUIC alternative server is expected to be valid | 1002 // The certificate of a QUIC alternative server is expected to be valid |
| 1003 // for the origin of the request (in addition to being valid for the | 1003 // for the origin of the request (in addition to being valid for the |
| 1004 // server itself). | 1004 // server itself). |
| 1005 destination = server_; | 1005 destination = server_; |
| 1006 origin_host = origin_url_.host(); | 1006 origin_host = origin_url_.host(); |
| 1007 ssl_config = &server_ssl_config_; | 1007 ssl_config = &server_ssl_config_; |
| 1008 } | 1008 } |
| 1009 int rv = | 1009 int rv = quic_request_.Request(destination, request_info_.privacy_mode, |
| 1010 quic_request_.Request(destination, request_info_.privacy_mode, | 1010 ssl_config->GetCertVerifyFlags(), |
| 1011 ssl_config->GetCertVerifyFlags(), origin_host, | 1011 origin_host, request_info_.method, net_log_, |
| 1012 request_info_.method, net_log_, io_callback_); | 1012 io_callback_, for_bidirectional_); |
| 1013 if (rv == OK) { | 1013 if (rv == OK) { |
| 1014 using_existing_quic_session_ = true; | 1014 using_existing_quic_session_ = true; |
| 1015 } else { | 1015 } else { |
| 1016 // OK, there's no available QUIC session. Let |waiting_job_| resume | 1016 // OK, there's no available QUIC session. Let |waiting_job_| resume |
| 1017 // if it's paused. | 1017 // if it's paused. |
| 1018 if (waiting_job_) { | 1018 if (waiting_job_) { |
| 1019 if (rv == ERR_IO_PENDING) { | 1019 if (rv == ERR_IO_PENDING) { |
| 1020 // Start the |waiting_job_| after the delay returned by | 1020 // Start the |waiting_job_| after the delay returned by |
| 1021 // GetTimeDelayForWaitingJob(). | 1021 // GetTimeDelayForWaitingJob(). |
| 1022 // | 1022 // |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 MaybeMarkAlternativeServiceBroken(); | 1240 MaybeMarkAlternativeServiceBroken(); |
| 1241 return result; | 1241 return result; |
| 1242 } | 1242 } |
| 1243 | 1243 |
| 1244 if (using_quic_) { | 1244 if (using_quic_) { |
| 1245 if (result < 0) { | 1245 if (result < 0) { |
| 1246 job_status_ = STATUS_BROKEN; | 1246 job_status_ = STATUS_BROKEN; |
| 1247 MaybeMarkAlternativeServiceBroken(); | 1247 MaybeMarkAlternativeServiceBroken(); |
| 1248 return result; | 1248 return result; |
| 1249 } | 1249 } |
| 1250 stream_ = quic_request_.ReleaseStream(); | 1250 if (for_bidirectional_) { |
| 1251 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
| 1252 bidirectional_stream_job_ = quic_request_.ReleaseBidirectionalStreamJob(); |
| 1253 #else |
| 1254 NOTREACHED(); |
| 1255 #endif |
| 1256 } else { |
| 1257 stream_ = quic_request_.ReleaseStream(); |
| 1258 } |
| 1251 next_state_ = STATE_NONE; | 1259 next_state_ = STATE_NONE; |
| 1252 return OK; | 1260 return OK; |
| 1253 } | 1261 } |
| 1254 | 1262 |
| 1255 if (result < 0 && !ssl_started) | 1263 if (result < 0 && !ssl_started) |
| 1256 return ReconsiderProxyAfterError(result); | 1264 return ReconsiderProxyAfterError(result); |
| 1257 establishing_tunnel_ = false; | 1265 establishing_tunnel_ = false; |
| 1258 | 1266 |
| 1259 if (connection_->socket()) { | 1267 if (connection_->socket()) { |
| 1260 // We officially have a new connection. Record the type. | 1268 // We officially have a new connection. Record the type. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 if (connection_->socket()) { | 1796 if (connection_->socket()) { |
| 1789 ConnectionAttempts socket_attempts; | 1797 ConnectionAttempts socket_attempts; |
| 1790 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1798 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1791 request_->AddConnectionAttempts(socket_attempts); | 1799 request_->AddConnectionAttempts(socket_attempts); |
| 1792 } else { | 1800 } else { |
| 1793 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1801 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1794 } | 1802 } |
| 1795 } | 1803 } |
| 1796 | 1804 |
| 1797 } // namespace net | 1805 } // namespace net |
| OLD | NEW |