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

Unified Diff: net/quic/chromium/quic_http_stream.cc

Issue 2461683002: Slice enum HttpResponseInfo::ConnectionInfo by QUIC version. (Closed)
Patch Set: Add return value in case of enum with value out of range. Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/chromium/quic_http_stream.cc
diff --git a/net/quic/chromium/quic_http_stream.cc b/net/quic/chromium/quic_http_stream.cc
index 647ebb1b6b70e62d4bdb7f68604e18339b616da0..8c41b695e1b9dc4f1a0a0a33bf7341c4c5d75140 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -46,6 +46,7 @@ QuicHttpStream::QuicHttpStream(
const base::WeakPtr<QuicChromiumClientSession>& session)
: next_state_(STATE_NONE),
session_(session),
+ quic_version_(session->GetQuicVersion()),
Ryan Hamilton 2016/10/28 19:02:02 We're only speaking 1 version of QUIC at a time in
Bence 2016/11/01 15:11:23 Hm, I see. QuicFramer's version can change after
Ryan Hamilton 2016/11/03 14:33:05 SGTM!
session_error_(OK),
was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()),
stream_(nullptr),
@@ -127,6 +128,26 @@ void QuicHttpStream::OnRendezvousResult(QuicSpdyStream* stream) {
OnIOComplete(OK);
}
+HttpResponseInfo::ConnectionInfo QuicHttpStream::ConnectionInfoFromQuicVersion(
+ QuicVersion quic_version) {
+ switch (quic_version) {
+ case QUIC_VERSION_UNSUPPORTED:
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_UNKNOWN_VERSION;
+ case QUIC_VERSION_32:
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_32;
+ case QUIC_VERSION_33:
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_33;
+ case QUIC_VERSION_34:
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_34;
+ case QUIC_VERSION_35:
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_35;
+ case QUIC_VERSION_36:
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_36;
+ }
+ NOTREACHED();
+ return HttpResponseInfo::CONNECTION_INFO_QUIC_UNKNOWN_VERSION;
+}
+
int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
RequestPriority priority,
const NetLogWithSource& stream_net_log,
@@ -430,7 +451,7 @@ void QuicHttpStream::Drain(HttpNetworkSession* session) {
}
void QuicHttpStream::PopulateNetErrorDetails(NetErrorDetails* details) {
- details->connection_info = HttpResponseInfo::CONNECTION_INFO_QUIC;
+ details->connection_info = ConnectionInfoFromQuicVersion(quic_version_);
if (was_handshake_confirmed_)
details->quic_connection_error = quic_connection_error_;
if (session_) {
@@ -788,11 +809,13 @@ int QuicHttpStream::ProcessResponseHeaders(const SpdyHeaderBlock& headers) {
// Put the peer's IP address and port into the response.
IPEndPoint address = session_->peer_address();
response_info_->socket_address = HostPortPair::FromIPEndPoint(address);
- response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_QUIC;
+ response_info_->connection_info =
+ ConnectionInfoFromQuicVersion(quic_version_);
response_info_->vary_data.Init(*request_info_,
*response_info_->headers.get());
response_info_->was_alpn_negotiated = true;
- response_info_->alpn_negotiated_protocol = "quic/1+spdy/3";
+ response_info_->alpn_negotiated_protocol =
+ HttpResponseInfo::ConnectionInfoToString(response_info_->connection_info);
response_info_->response_time = base::Time::Now();
response_info_->request_time = request_time_;
response_headers_received_ = true;

Powered by Google App Engine
This is Rietveld 408576698