Do not send out MAX_PUSH_ID frame if the client sets max_push_id to 0(default value).

Client side change only. not protected.

PiperOrigin-RevId: 326568330
Change-Id: I5776857f36209506a948b33ad32e11077eb6032f
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index f3c96e9..9a9f445 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -1330,6 +1330,11 @@
     DCHECK_GE(max_push_id, max_push_id_.value());
   }
 
+  if (!max_push_id_.has_value() && max_push_id == 0) {
+    // The default max_push_id is 0. So no need to send out MaxPushId frame.
+    return;
+  }
+
   ietf_server_push_enabled_ = true;
 
   if (max_push_id_.has_value()) {
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 18d3d75..189deac 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -3013,6 +3013,21 @@
   CompleteHandshake();
 }
 
+TEST_P(QuicSpdySessionTestClient, DoNotSendInitialMaxPushIdIfSetToDefaut) {
+  if (!VersionUsesHttp3(transport_version())) {
+    return;
+  }
+
+  StrictMock<MockHttp3DebugVisitor> debug_visitor;
+  session_.set_debug_visitor(&debug_visitor);
+
+  session_.SetMaxPushId(0);
+
+  InSequence s;
+  EXPECT_CALL(debug_visitor, OnSettingsFrameSent(_));
+  CompleteHandshake();
+}
+
 }  // namespace
 }  // namespace test
 }  // namespace quic