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/quic/chromium/quic_http_stream.h" | 5 #include "net/quic/chromium/quic_http_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 QuicHttpStream::QuicHttpStream( | 47 QuicHttpStream::QuicHttpStream( |
48 const base::WeakPtr<QuicChromiumClientSession>& session, | 48 const base::WeakPtr<QuicChromiumClientSession>& session, |
49 HttpServerProperties* http_server_properties) | 49 HttpServerProperties* http_server_properties) |
50 : MultiplexedHttpStream(MultiplexedSessionHandle(session)), | 50 : MultiplexedHttpStream(MultiplexedSessionHandle(session)), |
51 next_state_(STATE_NONE), | 51 next_state_(STATE_NONE), |
52 session_(session), | 52 session_(session), |
| 53 server_id_(session->server_id()), |
53 http_server_properties_(http_server_properties), | 54 http_server_properties_(http_server_properties), |
54 quic_version_(session->GetQuicVersion()), | 55 quic_version_(session->GetQuicVersion()), |
55 session_error_(ERR_UNEXPECTED), | 56 session_error_(ERR_UNEXPECTED), |
56 was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()), | 57 was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()), |
57 stream_(nullptr), | 58 stream_(nullptr), |
58 request_info_(nullptr), | 59 request_info_(nullptr), |
59 request_body_stream_(nullptr), | 60 request_body_stream_(nullptr), |
60 priority_(MINIMUM_PRIORITY), | 61 priority_(MINIMUM_PRIORITY), |
61 response_info_(nullptr), | 62 response_info_(nullptr), |
62 has_response_status_(false), | 63 has_response_status_(false), |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 is_first_stream = stream_->IsFirstStream(); | 416 is_first_stream = stream_->IsFirstStream(); |
416 if (is_first_stream) { | 417 if (is_first_stream) { |
417 load_timing_info->socket_reused = false; | 418 load_timing_info->socket_reused = false; |
418 load_timing_info->connect_timing = connect_timing_; | 419 load_timing_info->connect_timing = connect_timing_; |
419 } else { | 420 } else { |
420 load_timing_info->socket_reused = true; | 421 load_timing_info->socket_reused = true; |
421 } | 422 } |
422 return true; | 423 return true; |
423 } | 424 } |
424 | 425 |
| 426 bool QuicHttpStream::GetAlternativeService( |
| 427 AlternativeService* alternative_service) const { |
| 428 alternative_service->protocol = kProtoQUIC; |
| 429 alternative_service->host = server_id_.host(); |
| 430 alternative_service->port = server_id_.port(); |
| 431 return true; |
| 432 } |
| 433 |
425 void QuicHttpStream::PopulateNetErrorDetails(NetErrorDetails* details) { | 434 void QuicHttpStream::PopulateNetErrorDetails(NetErrorDetails* details) { |
426 details->connection_info = ConnectionInfoFromQuicVersion(quic_version_); | 435 details->connection_info = ConnectionInfoFromQuicVersion(quic_version_); |
427 if (was_handshake_confirmed_) | 436 if (was_handshake_confirmed_) |
428 details->quic_connection_error = quic_connection_error_; | 437 details->quic_connection_error = quic_connection_error_; |
429 if (session_) { | 438 if (session_) { |
430 session_->PopulateNetErrorDetails(details); | 439 session_->PopulateNetErrorDetails(details); |
431 } else { | 440 } else { |
432 details->quic_port_migration_detected = port_migration_detected_; | 441 details->quic_port_migration_detected = port_migration_detected_; |
433 } | 442 } |
434 } | 443 } |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 // If |response_info_| is null then the request has not been sent, so | 880 // If |response_info_| is null then the request has not been sent, so |
872 // return ERR_CONNECTION_CLOSED to permit HttpNetworkTransaction to | 881 // return ERR_CONNECTION_CLOSED to permit HttpNetworkTransaction to |
873 // retry the request. | 882 // retry the request. |
874 if (!response_info_) | 883 if (!response_info_) |
875 return ERR_CONNECTION_CLOSED; | 884 return ERR_CONNECTION_CLOSED; |
876 | 885 |
877 return ERR_QUIC_PROTOCOL_ERROR; | 886 return ERR_QUIC_PROTOCOL_ERROR; |
878 } | 887 } |
879 | 888 |
880 } // namespace net | 889 } // namespace net |
OLD | NEW |