Add expect_final_byte_offset argument to CopyAndValidateTrailers().
This will be used in cr/231494986 where trailers sent on the
request/response stream should not have the :final-offset pseudo-header.
gfe-relnote: n/a. No functional change.
PiperOrigin-RevId: 243730777
Change-Id: I1a5c729fb5aab3e3abdb0ce64dad5667faf794bf
diff --git a/quic/core/http/spdy_utils.h b/quic/core/http/spdy_utils.h
index 444dd7f..dc3fabc 100644
--- a/quic/core/http/spdy_utils.h
+++ b/quic/core/http/spdy_utils.h
@@ -32,7 +32,17 @@
spdy::SpdyHeaderBlock* headers);
// Copies a list of headers to a SpdyHeaderBlock.
+ // If |expect_final_byte_offset| is true, requires exactly one header field
+ // with key kFinalOffsetHeaderKey and an integer value.
+ // If |expect_final_byte_offset| is false, no kFinalOffsetHeaderKey may be
+ // present.
+ // Returns true if parsing is successful. Returns false if the presence of
+ // kFinalOffsetHeaderKey does not match the value of
+ // |expect_final_byte_offset|, the kFinalOffsetHeaderKey value cannot be
+ // parsed, any other pseudo-header is present, an empty header key is present,
+ // or a header key contains an uppercase character.
static bool CopyAndValidateTrailers(const QuicHeaderList& header_list,
+ bool expect_final_byte_offset,
size_t* final_byte_offset,
spdy::SpdyHeaderBlock* trailers);