Stop padding QUIC_CRYPTO CHLOs

Before 2016, the QUIC code relied on the size of CHLO messages to dictate maximum response sizes (to avoid amplification attacks). However since cl/129160718 and cl/133633175 landed in 2016, we do not rely on that anymore. Instead we use the size of the packet that contained the CHLO. This is also what is mandated by the IETF QUIC spec. This CL removes unnecessary padding from CHLO messages which could lead to more efficient handshakes. It also adds a check in QuicDispatcher to validate the length of Q043 CHLO packets since the length check only applied to subsequent versions.

Stop padding chlo, protected by gfe2_reloadable_flag_quic_dont_pad_chlo

PiperOrigin-RevId: 317320920
Change-Id: I17d60625886648105905a9e811c9b1def5856fd5
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index 12008c4..fc8fd4a 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -1287,8 +1287,12 @@
 }
 
 TEST_P(QuicDispatcherTestAllVersions, DoNotProcessSmallPacket) {
-  if (!version_.HasIetfInvariantHeader()) {
-    // We only drop small packets when using IETF_QUIC_LONG_HEADER_PACKET.
+  if (!version_.HasIetfInvariantHeader() &&
+      !GetQuicReloadableFlag(quic_dont_pad_chlo)) {
+    // When quic_dont_pad_chlo is false, we only drop small packets when using
+    // IETF_QUIC_LONG_HEADER_PACKET. When quic_dont_pad_chlo is true, we drop
+    // small packets for all versions.
+    // TODO(dschinazi) remove this early return when we deprecate the flag.
     return;
   }
   CreateTimeWaitListManager();