Allow long header lengths in versions without IETF frames This is safe without an explicit flag because QuicFramer::WriteIetfLongHeaderLength returns true when the version does not support long header lengths, which is the case for all versions other than v99. http://google3/third_party/quic/core/quic_framer.cc?l=826&rcl=268972396 The goal of this change is to allow creating v49 which supports long header lengths but not IETF frames. gfe-relnote: refactor without behavior change, protected by disabled v99 flag PiperOrigin-RevId: 269738816 Change-Id: I5b69f7a0393e81856a7dc1efcd4a5baa1ebb8dab
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc index db6b867..010d478 100644 --- a/quic/core/quic_framer.cc +++ b/quic/core/quic_framer.cc
@@ -872,9 +872,6 @@ } return writer.length(); } - // TODO(dschinazi) if we enable long header lengths before v99, we need to - // add support for fixing up lengths in QuicFramer::BuildDataPacket. - DCHECK(!QuicVersionHasLongHeaderLengths(transport_version())); size_t i = 0; for (const QuicFrame& frame : frames) { @@ -1009,6 +1006,10 @@ ++i; } + if (!WriteIetfLongHeaderLength(header, &writer, length_field_offset, level)) { + return 0; + } + return writer.length(); }
diff --git a/quic/core/quic_versions.h b/quic/core/quic_versions.h index 98ffc2c..8a992ec 100644 --- a/quic/core/quic_versions.h +++ b/quic/core/quic_versions.h
@@ -411,8 +411,6 @@ // length field as defined by IETF QUIC draft-13 and later. QUIC_EXPORT_PRIVATE inline bool QuicVersionHasLongHeaderLengths( QuicTransportVersion transport_version) { - // TODO(dschinazi) if we enable long header lengths before v99, we need to - // add support for fixing up lengths in QuicFramer::BuildDataPacket. return transport_version == QUIC_VERSION_99; }