Remove QuicSpdySession::server_push_enabled() and deprecate QNSP connection tag.

PiperOrigin-RevId: 370735636
Change-Id: Iaa83c76f88a6716427e301bd221fbfbd72a9d075
diff --git a/quic/core/crypto/crypto_protocol.h b/quic/core/crypto/crypto_protocol.h
index 8a86255..c485a25 100644
--- a/quic/core/crypto/crypto_protocol.h
+++ b/quic/core/crypto/crypto_protocol.h
@@ -28,7 +28,7 @@
 
 // The following tags have been deprecated and should not be reused:
 // "1CON", "BBQ4", "NCON", "RCID", "SREJ", "TBKP", "TB10", "SCLS", "SMHL",
-// "QNZR", "B2HI", "H2PR", "FIFO", "LIFO", "RRWS"
+// "QNZR", "B2HI", "H2PR", "FIFO", "LIFO", "RRWS", "QNSP"
 
 // clang-format off
 const QuicTag kCHLO = TAG('C', 'H', 'L', 'O');   // Client hello
@@ -402,9 +402,6 @@
 
 const QuicTag kQNZ2 = TAG('Q', 'N', 'Z', '2');   // Turn off QUIC crypto 0-RTT.
 
-const QuicTag kQNSP = TAG('Q', 'N', 'S', 'P');   // Turn off server push in
-                                                 // gQUIC.
-
 const QuicTag kMAD  = TAG('M', 'A', 'D', 0);     // Max Ack Delay (IETF QUIC)
 
 const QuicTag kIGNP = TAG('I', 'G', 'N', 'P');   // Do not use PING only packet
diff --git a/quic/core/http/quic_headers_stream_test.cc b/quic/core/http/quic_headers_stream_test.cc
index 55dafac..42fef63 100644
--- a/quic/core/http/quic_headers_stream_test.cc
+++ b/quic/core/http/quic_headers_stream_test.cc
@@ -563,6 +563,10 @@
 }
 
 TEST_P(QuicHeadersStreamTest, ProcessPushPromiseDisabledSetting) {
+  if (perspective() != Perspective::IS_CLIENT) {
+    return;
+  }
+
   session_.OnConfigNegotiated();
   SpdySettingsIR data;
   // Respect supported settings frames SETTINGS_ENABLE_PUSH.
@@ -570,15 +574,11 @@
   SpdySerializedFrame frame(framer_->SerializeFrame(data));
   stream_frame_.data_buffer = frame.data();
   stream_frame_.data_length = frame.size();
-  if (perspective() == Perspective::IS_CLIENT) {
-    EXPECT_CALL(
-        *connection_,
-        CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
-                        "Unsupported field of HTTP/2 SETTINGS frame: 2", _));
-  }
+  EXPECT_CALL(
+      *connection_,
+      CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
+                      "Unsupported field of HTTP/2 SETTINGS frame: 2", _));
   headers_stream_->OnStreamFrame(stream_frame_);
-  EXPECT_EQ(session_.server_push_enabled(),
-            perspective() == Perspective::IS_CLIENT);
 }
 
 TEST_P(QuicHeadersStreamTest, ProcessLargeRawData) {
diff --git a/quic/core/http/quic_server_session_base.cc b/quic/core/http/quic_server_session_base.cc
index b955835..c78df58 100644
--- a/quic/core/http/quic_server_session_base.cc
+++ b/quic/core/http/quic_server_session_base.cc
@@ -50,12 +50,6 @@
     return;
   }
 
-  // Disable server push if peer sends the corresponding connection option.
-  if (!version().UsesHttp3() &&
-      ContainsQuicTag(config()->ReceivedConnectionOptions(), kQNSP)) {
-    OnSetting(spdy::SETTINGS_ENABLE_PUSH, 0);
-  }
-
   // Enable bandwidth resumption if peer sent correct connection options.
   const bool last_bandwidth_resumption =
       ContainsQuicTag(config()->ReceivedConnectionOptions(), kBWRE);
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc
index 52ddc91..ac7fc1e 100644
--- a/quic/core/http/quic_server_session_base_test.cc
+++ b/quic/core/http/quic_server_session_base_test.cc
@@ -723,20 +723,6 @@
       QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
 }
 
-TEST_P(QuicServerSessionBaseTest, TurnOffServerPush) {
-  if (VersionHasIetfQuicFrames(transport_version())) {
-    return;
-  }
-
-  EXPECT_TRUE(session_->server_push_enabled());
-  QuicTagVector copt;
-  copt.push_back(kQNSP);
-  QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
-  connection_->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
-  session_->OnConfigNegotiated();
-  EXPECT_FALSE(session_->server_push_enabled());
-}
-
 // Tests which check the lifetime management of data members of
 // QuicCryptoServerStream objects when async GetProof is in use.
 class StreamMemberLifetimeTest : public QuicServerSessionBaseTest {
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 2b22fbe..084b596 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -497,7 +497,6 @@
       spdy_framer_visitor_(new SpdyFramerVisitor(this)),
       debug_visitor_(nullptr),
       destruction_indicator_(123456789),
-      server_push_enabled_(true),
       next_available_datagram_flow_id_(perspective() == Perspective::IS_SERVER
                                            ? kFirstDatagramFlowIdServer
                                            : kFirstDatagramFlowIdClient) {
@@ -858,10 +857,6 @@
       absl::string_view(frame.data(), frame.size()), false, nullptr);
 }
 
-bool QuicSpdySession::server_push_enabled() const {
-  return VersionUsesHttp3(transport_version()) ? false : server_push_enabled_;
-}
-
 void QuicSpdySession::SendInitialData() {
   if (!VersionUsesHttp3(transport_version())) {
     return;
@@ -1239,8 +1234,7 @@
           return true;
         }
         QUIC_DVLOG(1) << ENDPOINT << "SETTINGS_ENABLE_PUSH received with value "
-                      << value;
-        server_push_enabled_ = value;
+                      << value << ", ignoring.";
         break;
       } else {
         QUIC_DLOG(ERROR)
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index b200484..823bb2e 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -251,12 +251,6 @@
 
   const QuicHeadersStream* headers_stream() const { return headers_stream_; }
 
-  // Returns whether server push is enabled.
-  // For a Google QUIC client this always returns false.
-  // For a Google QUIC server this is set by incoming SETTINGS_ENABLE_PUSH.
-  // For an IETF QUIC client or server this returns false.
-  bool server_push_enabled() const;
-
   // Called when the control stream receives HTTP/3 SETTINGS.
   // Returns false in case of 0-RTT if received settings are incompatible with
   // cached values, true otherwise.
@@ -684,10 +678,6 @@
   // an use-after-free.
   int32_t destruction_indicator_;
 
-  // Used in Google QUIC only.  Set every time SETTINGS_ENABLE_PUSH is received.
-  // Defaults to true.
-  bool server_push_enabled_;
-
   // The identifier in the most recently received GOAWAY frame.  Unset if no
   // GOAWAY frame has been received yet.
   absl::optional<uint64_t> last_received_http3_goaway_id_;
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 34a7ebc..c638a0a 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -2938,14 +2938,6 @@
   session_.OnStreamFrame(data3);
 }
 
-TEST_P(QuicSpdySessionTestServer, ServerPushEnabledDefaultValue) {
-  if (VersionUsesHttp3(transport_version())) {
-    EXPECT_FALSE(session_.server_push_enabled());
-  } else {
-    EXPECT_TRUE(session_.server_push_enabled());
-  }
-}
-
 TEST_P(QuicSpdySessionTestServer, OnSetting) {
   CompleteHandshake();
   if (VersionUsesHttp3(transport_version())) {
@@ -2975,10 +2967,6 @@
   session_.OnSetting(SETTINGS_MAX_FIELD_SECTION_SIZE, 5);
   EXPECT_EQ(5u, session_.max_outbound_header_list_size());
 
-  EXPECT_TRUE(session_.server_push_enabled());
-  session_.OnSetting(spdy::SETTINGS_ENABLE_PUSH, 0);
-  EXPECT_FALSE(session_.server_push_enabled());
-
   spdy::HpackEncoder* hpack_encoder =
       QuicSpdySessionPeer::GetSpdyFramer(&session_)->GetHpackEncoder();
   EXPECT_EQ(4096u, hpack_encoder->CurrentHeaderTableSizeSetting());