Roll src/net/third_party/quiche/src/ 7498c8c59..82875de9a5 (14 commits)

https://quiche.googlesource.com/quiche.git/+log/7498c8c59b8a..82875de9a5

2019-07-09 dschinazi Rollback of 257189926
2019-07-09 wub Implement BBRv2 for QUIC
2019-07-09 bnc QuicSpdySession header size limit related cleanup.
2019-07-09 bnc Blocked decoding part 3: QpackDecodedHeadersAccumulator and QuicSpdyStream.
2019-07-09 bnc Close connection on incorrect order of HEADERS and DATA frames.
2019-07-09 bnc Blocked decoding part 2: QpackProgressiveDecoder.
2019-07-08 ianswett gfe-relnote: Print out a SPDY_BUG and exit early rather than crash when Http2FrameDecoderAdapter is nullptr.  Not flag protected.
2019-07-08 bnc Blocked decoding part 1: QpackHeaderTable::Observer.
2019-07-08 bnc QuicSpdySessionPeer::SetMaxInboundHeaderListSize()
2019-07-08 renjietang gfe-relnote: deprecate gfe2_reloadable_flag_quic_eliminate_static_stream_map_3.
2019-07-08 vasilvv Add operator<< support to QuicSocketAddress.
2019-07-08 nharper Fix check in proto_to_packet_translator to make sure packets are long enough
2019-07-08 fayang gfe-relnote: Deprecate gfe2_reloadable_flag_quic_simplify_stop_waiting.
2019-07-03 renjietang Remove unused pending stream constructors.
2019-07-03 danzh gfe-relnote: n/a(refactor only) Split out utility functions needed on quic client side from SpdyUtils.
2019-07-02 nharper gfe-relnote: Move QUIC crypto frames to be gated behind new flag gfe2_reloadable_flag_quic_enable_version_48

Created with:
  roll-dep src/net/third_party/quiche/src src/third_party/quic_trace/src

Change-Id: Ia695aa51737a27161038ca17ed491d240221ea9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695645
Commit-Queue: David Schinazi <[email protected]>
Reviewed-by: Nick Harper <[email protected]>
Cr-Commit-Position: refs/heads/master@{#676700}
diff --git a/DEPS b/DEPS
index dbb078b1..7eee1c2 100644
--- a/DEPS
+++ b/DEPS
@@ -281,7 +281,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling feed
   # and whatever else without interference from each other.
-  'quiche_revision': '7498c8c59b8a8ea83db9368a889323bd0b146544',
+  'quiche_revision': '82875de9a5fbb57cac3cea971aa249b321d24d96',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling ios_webkit
   # and whatever else without interference from each other.
diff --git a/chrome/browser/page_load_metrics/protocol_util.cc b/chrome/browser/page_load_metrics/protocol_util.cc
index 786adfa2..537e489 100644
--- a/chrome/browser/page_load_metrics/protocol_util.cc
+++ b/chrome/browser/page_load_metrics/protocol_util.cc
@@ -39,6 +39,7 @@
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_45:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_46:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_47:
+    case net::HttpResponseInfo::CONNECTION_INFO_QUIC_48:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_99:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_999:
       return NetworkProtocol::kQuic;
diff --git a/components/domain_reliability/util.cc b/components/domain_reliability/util.cc
index 9ae0da34..815e4ee 100644
--- a/components/domain_reliability/util.cc
+++ b/components/domain_reliability/util.cc
@@ -133,6 +133,7 @@
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_45:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_46:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_47:
+    case net::HttpResponseInfo::CONNECTION_INFO_QUIC_48:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_99:
     case net::HttpResponseInfo::CONNECTION_INFO_QUIC_999:
       return "QUIC";
diff --git a/net/BUILD.gn b/net/BUILD.gn
index b271a568..dfcd25da 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -1511,6 +1511,8 @@
       "third_party/quiche/src/quic/core/http/quic_spdy_stream.h",
       "third_party/quiche/src/quic/core/http/quic_spdy_stream_body_buffer.cc",
       "third_party/quiche/src/quic/core/http/quic_spdy_stream_body_buffer.h",
+      "third_party/quiche/src/quic/core/http/spdy_server_push_utils.cc",
+      "third_party/quiche/src/quic/core/http/spdy_server_push_utils.h",
       "third_party/quiche/src/quic/core/http/spdy_utils.cc",
       "third_party/quiche/src/quic/core/http/spdy_utils.h",
       "third_party/quiche/src/quic/core/legacy_quic_stream_id_manager.cc",
@@ -5494,6 +5496,7 @@
     "third_party/quiche/src/quic/core/http/quic_spdy_session_test.cc",
     "third_party/quiche/src/quic/core/http/quic_spdy_stream_body_buffer_test.cc",
     "third_party/quiche/src/quic/core/http/quic_spdy_stream_test.cc",
+    "third_party/quiche/src/quic/core/http/spdy_server_push_utils_test.cc",
     "third_party/quiche/src/quic/core/http/spdy_utils_test.cc",
     "third_party/quiche/src/quic/core/legacy_quic_stream_id_manager_test.cc",
     "third_party/quiche/src/quic/core/packet_number_indexed_queue_test.cc",
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc
index 1debeba..0b9844e9 100644
--- a/net/http/http_response_info.cc
+++ b/net/http/http_response_info.cc
@@ -419,6 +419,7 @@
     case CONNECTION_INFO_QUIC_45:
     case CONNECTION_INFO_QUIC_46:
     case CONNECTION_INFO_QUIC_47:
+    case CONNECTION_INFO_QUIC_48:
     case CONNECTION_INFO_QUIC_99:
     case CONNECTION_INFO_QUIC_999:
       return true;
@@ -485,6 +486,8 @@
       return "http/2+quic/46";
     case CONNECTION_INFO_QUIC_47:
       return "http/2+quic/47";
+    case CONNECTION_INFO_QUIC_48:
+      return "http/2+quic/48";
     case CONNECTION_INFO_QUIC_99:
       return "http/2+quic/99";
     case CONNECTION_INFO_HTTP0_9:
diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h
index 742cf23..1f75fe4 100644
--- a/net/http/http_response_info.h
+++ b/net/http/http_response_info.h
@@ -63,6 +63,7 @@
     CONNECTION_INFO_QUIC_46 = 25,
     CONNECTION_INFO_QUIC_47 = 26,
     CONNECTION_INFO_QUIC_999 = 27,
+    CONNECTION_INFO_QUIC_48 = 28,
     NUM_OF_CONNECTION_INFOS,
   };
 
diff --git a/net/http/http_stream_factory_unittest.cc b/net/http/http_stream_factory_unittest.cc
index 8162bec..bb7f75c 100644
--- a/net/http/http_stream_factory_unittest.cc
+++ b/net/http/http_stream_factory_unittest.cc
@@ -2243,6 +2243,9 @@
         proxy_resolution_service_(ProxyResolutionService::CreateDirect()),
         ssl_config_service_(new SSLConfigServiceDefaults) {
     clock_.AdvanceTime(quic::QuicTime::Delta::FromMilliseconds(20));
+    if (version_.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
+    }
   }
 
   void TearDown() override { session_.reset(); }
@@ -2317,6 +2320,7 @@
   quic::ParsedQuicVersion version() const { return version_; }
 
  private:
+  QuicFlagSaver saver_;
   const quic::ParsedQuicVersion version_;
   const bool client_headers_include_h2_stream_dependency_;
   quic::MockClock clock_;
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc
index adbe7514..9260695 100644
--- a/net/quic/quic_chromium_client_session.cc
+++ b/net/quic/quic_chromium_client_session.cc
@@ -45,7 +45,7 @@
 #include "net/ssl/ssl_connection_status_flags.h"
 #include "net/ssl/ssl_info.h"
 #include "net/third_party/quiche/src/quic/core/http/quic_client_promised_info.h"
-#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
+#include "net/third_party/quiche/src/quic/core/http/spdy_server_push_utils.h"
 #include "net/third_party/quiche/src/quic/core/quic_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
@@ -2421,14 +2421,6 @@
 }
 
 void QuicChromiumClientSession::CloseAllStreams(int net_error) {
-  if (!eliminate_static_stream_map()) {
-    while (!dynamic_streams().empty()) {
-      quic::QuicStream* stream = dynamic_streams().begin()->second.get();
-      quic::QuicStreamId id = stream->id();
-      static_cast<QuicChromiumClientStream*>(stream)->OnError(net_error);
-      CloseStream(id);
-    }
-  } else {
     quic::QuicSmallMap<quic::QuicStreamId, quic::QuicStream*, 10>
         non_static_streams;
     for (const auto& stream : dynamic_streams()) {
@@ -2441,7 +2433,6 @@
       static_cast<QuicChromiumClientStream*>(stream.second)->OnError(net_error);
       CloseStream(id);
     }
-  }
 }
 
 void QuicChromiumClientSession::CloseAllHandles(int net_error) {
@@ -2649,7 +2640,7 @@
   auto it = dynamic_streams().begin();
   // Stream may be deleted when iterating through the map.
   while (it != dynamic_streams().end()) {
-    if (eliminate_static_stream_map() && it->second->is_static()) {
+    if (it->second->is_static()) {
       it++;
       continue;
     }
@@ -2774,8 +2765,9 @@
   std::unique_ptr<base::ListValue> stream_list(new base::ListValue());
   for (DynamicStreamMap::const_iterator it = dynamic_streams().begin();
        it != dynamic_streams().end(); ++it) {
-    if (eliminate_static_stream_map() && it->second->is_static())
+    if (it->second->is_static()) {
       continue;
+    }
     stream_list->AppendString(base::NumberToString(it->second->id()));
   }
   dict.Set("active_streams", std::move(stream_list));
@@ -3037,7 +3029,7 @@
     // promise has been received.
     if (push_delegate_) {
       std::string pushed_url =
-          quic::SpdyUtils::GetPromisedUrlFromHeaders(headers);
+          quic::SpdyServerPushUtils::GetPromisedUrlFromHeaders(headers);
       push_delegate_->OnPush(std::make_unique<QuicServerPushHelper>(
                                  weak_factory_.GetWeakPtr(), GURL(pushed_url)),
                              net_log_);
diff --git a/net/quic/quic_flags_list.h b/net/quic/quic_flags_list.h
index 341029b..5a2cff3d 100644
--- a/net/quic/quic_flags_list.h
+++ b/net/quic/quic_flags_list.h
@@ -61,6 +61,10 @@
 // When true, defaults to BBR congestion control instead of Cubic.
 QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_default_to_bbr, false)
 
+// If true, use BBRv2 as the default congestion controller.
+// Takes precedence over --quic_default_to_bbr.
+QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_default_to_bbr_v2, false)
+
 // If buffered data in QUIC stream is less than this threshold, buffers all
 // provided data or asks upper layer for more data.
 QUIC_FLAG(uint32_t, FLAGS_quic_buffered_data_threshold, 8192u)
@@ -185,9 +189,12 @@
           FLAGS_quic_reloadable_flag_quic_log_cert_name_for_empty_sct,
           true)
 
-// If true, enable QUIC version 47 which adds CRYPTO frames.
+// If true, enable QUIC version 47.
 QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_version_47, false)
 
+// If true, enable QUIC version 48.
+QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_version_48, false)
+
 // If true, disable QUIC version 39.
 QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_disable_version_39, false)
 
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index 0d1da7f8..d6459fa 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -89,6 +89,8 @@
       return HttpResponseInfo::CONNECTION_INFO_QUIC_46;
     case quic::QUIC_VERSION_47:
       return HttpResponseInfo::CONNECTION_INFO_QUIC_47;
+    case quic::QUIC_VERSION_48:
+      return HttpResponseInfo::CONNECTION_INFO_QUIC_48;
     case quic::QUIC_VERSION_99:
       return HttpResponseInfo::CONNECTION_INFO_QUIC_99;
     case quic::QUIC_VERSION_RESERVED_FOR_NEGOTIATION:
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index eff65950..0c0ba6c 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -54,7 +54,7 @@
 #include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
 #include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h"
 #include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h"
-#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
+#include "net/third_party/quiche/src/quic/core/http/spdy_server_push_utils.h"
 #include "net/third_party/quiche/src/quic/core/quic_connection.h"
 #include "net/third_party/quiche/src/quic/core/quic_utils.h"
 #include "net/third_party/quiche/src/quic/core/quic_write_blocked_list.h"
@@ -364,7 +364,8 @@
     promised_response_[":version"] = "HTTP/1.1";
     promised_response_["content-type"] = "text/plain";
 
-    promise_url_ = quic::SpdyUtils::GetPromisedUrlFromHeaders(push_promise_);
+    promise_url_ =
+        quic::SpdyServerPushUtils::GetPromisedUrlFromHeaders(push_promise_);
   }
 
   void SetRequest(const string& method,
@@ -2099,7 +2100,8 @@
   // packet, but does it matter?
 
   push_promise_[":authority"] = "mail.example.org";
-  promise_url_ = quic::SpdyUtils::GetPromisedUrlFromHeaders(push_promise_);
+  promise_url_ =
+      quic::SpdyServerPushUtils::GetPromisedUrlFromHeaders(push_promise_);
 
   ReceivePromise(promise_id_);
   EXPECT_NE(session_->GetPromisedByUrl(promise_url_), nullptr);
@@ -2169,7 +2171,8 @@
   // TODO(ckrasic) - could do this via constructing a PUSH_PROMISE
   // packet, but does it matter?
   push_promise_[":authority"] = "www.notexample.org";
-  promise_url_ = quic::SpdyUtils::GetPromisedUrlFromHeaders(push_promise_);
+  promise_url_ =
+      quic::SpdyServerPushUtils::GetPromisedUrlFromHeaders(push_promise_);
 
   ReceivePromise(promise_id_);
   // The promise will have been rejected because the cert doesn't
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc
index cd44890..9ec53ec 100644
--- a/net/quic/quic_proxy_client_socket_unittest.cc
+++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -152,6 +152,9 @@
     IPAddress ip(192, 0, 2, 33);
     peer_addr_ = IPEndPoint(ip, 443);
     clock_.AdvanceTime(quic::QuicTime::Delta::FromMilliseconds(20));
+    if (version_.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
+    }
   }
 
   void SetUp() override {}
@@ -532,6 +535,7 @@
     return std::string(buffer.get(), header_length);
   }
 
+  QuicFlagSaver saver_;
   const quic::ParsedQuicVersion version_;
   const quic::QuicStreamId client_data_stream_id1_;
   const bool client_headers_include_h2_stream_dependency_;
@@ -878,7 +882,8 @@
   std::string data(numDataPackets * quic::kDefaultMaxPacketSize, 'x');
   quic::QuicStreamOffset offset = kLen1 + header.length();
 
-  if (version_.transport_version == quic::QUIC_VERSION_99) {
+  if (version_.transport_version == quic::QUIC_VERSION_99 ||
+      version_.handshake_protocol == quic::PROTOCOL_TLS1_3) {
     numDataPackets++;
   }
   size_t total_data_length = 0;
@@ -896,12 +901,32 @@
                            {header2, std::string(data.c_str(),
                                                  max_packet_data_length - 7)}));
       offset += max_packet_data_length - header2.length() - 1;
+    } else if (version_.handshake_protocol == quic::PROTOCOL_TLS1_3 && i == 0) {
+      mock_quic_data_.AddWrite(
+          SYNCHRONOUS,
+          ConstructDataPacket(
+              write_packet_index++,
+              std::string(data.c_str(), max_packet_data_length - 4)));
+      offset += max_packet_data_length - 4;
     } else if (version_.transport_version == quic::QUIC_VERSION_99 &&
                i == numDataPackets - 1) {
       mock_quic_data_.AddWrite(
           SYNCHRONOUS, ConstructDataPacket(write_packet_index++,
                                            std::string(data.c_str(), 7)));
       offset += 7;
+    } else if (version_.handshake_protocol == quic::PROTOCOL_TLS1_3 &&
+               i == numDataPackets - 1) {
+      mock_quic_data_.AddWrite(
+          SYNCHRONOUS, ConstructDataPacket(write_packet_index++,
+                                           std::string(data.c_str(), 12)));
+      offset += 12;
+    } else if (version_.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      mock_quic_data_.AddWrite(
+          SYNCHRONOUS,
+          ConstructDataPacket(
+              write_packet_index++,
+              std::string(data.c_str(), max_packet_data_length - 4)));
+      offset += max_packet_data_length - 4;
     } else {
       mock_quic_data_.AddWrite(
           SYNCHRONOUS, ConstructDataPacket(
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index 1245878..634c39d 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -11139,10 +11139,11 @@
   EXPECT_TRUE(HasActiveJob(host_port_pair_, privacy_mode_));
 
   // The pending task is scheduled for handshake timeout retransmission,
-  // which is 2 * 400ms for v99 and 1.5 * 400ms for others.
-  int handshake_timeout = version_.transport_version == quic::QUIC_VERSION_99
-                              ? 2 * kInitialRtt
-                              : 1.5 * kInitialRtt;
+  // which is 2 * 400ms with crypto frames and 1.5 * 400ms otherwise.
+  int handshake_timeout =
+      QuicVersionUsesCryptoFrames(version_.transport_version)
+          ? 2 * kInitialRtt
+          : 1.5 * kInitialRtt;
   EXPECT_EQ(base::TimeDelta::FromMilliseconds(handshake_timeout),
             task_runner->NextPendingTaskDelay());
 
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 3f9913d8..1ff8cd7 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -54,7 +54,7 @@
 #include "net/spdy/spdy_stream.h"
 #include "net/ssl/ssl_cipher_suite_names.h"
 #include "net/ssl/ssl_connection_status_flags.h"
-#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
+#include "net/third_party/quiche/src/quic/core/http/spdy_server_push_utils.h"
 #include "net/third_party/quiche/src/spdy/core/spdy_frame_builder.h"
 #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
 #include "url/url_constants.h"
@@ -1904,7 +1904,7 @@
   streams_pushed_count_++;
 
   // Verify that the response had a URL for us.
-  GURL gurl(quic::SpdyUtils::GetPromisedUrlFromHeaders(headers));
+  GURL gurl(quic::SpdyServerPushUtils::GetPromisedUrlFromHeaders(headers));
   if (!gurl.is_valid()) {
     RecordSpdyPushedStreamFateHistogram(SpdyPushedStreamFate::kInvalidUrl);
     EnqueueResetStreamFrame(stream_id, request_priority,