Perform content-length validation in OgHttp2Session.

This CL validates the content-length header value in HeaderValidator and allows
the value to be checked in OgHttp2Session when comparing against actual
received body lengths for a stream. If there is a mismatch between the
content-length header value and the total body length received, OgHttp2Session
invokes the visitor OnInvalidFrame() callback and enqueues a RST_STREAM.

This change better aligns oghttp2 with nghttp2 on content-length validation,
but at least one remaining difference is that nghttp2 invokes OnInvalidFrame()
(leading to connection-level error-signalling in Envoy) only when the
content-length mismatch happens with HEADERS ending the stream [1]. The
OnInvalidFrame() --> connection error is important at least for a
content-length integration test. Therefore, oghttp2 also calls OnInvalidFrame()
for content-length mismatch, but regardless of whether HEADERS or DATA ends the
stream for unity. (Ideally, content-length mismatch on one stream should not
cause a connection-level error; perhaps this can be fixed once migration to
oghttp2 is complete.)

With this CL, MultiplexedIntegrationTest.InconsistentContentLength passes with
oghttp2 (http://sponge2/663d811a-e662-44c0-b003-a4d7fcb13d42).

[1] Compare HEADERS at
to DATA at

PiperOrigin-RevId: 422597021
8 files changed
tree: d3c3055159af8fc71b2109f070674f391e5c265a
  1. common/
  2. epoll_server/
  3. http2/
  4. quic/
  5. spdy/


QUICHE stands for QUIC, Http/2, Etc. It is Google‘s production-ready implementation of QUIC, HTTP/2, HTTP/3, and related protocols and tools. It powers Google’s servers, Chromium, Envoy, and other projects. It is actively developed and maintained.

There are two public QUICHE repositories. Either one may be used by embedders, as they are automatically kept in sync:

To embed QUICHE in your project, platform APIs need to be implemented and build files need to be created. Note that it is on the QUICHE team's roadmap to include default implementation for all platform APIs and to open-source build files. In the meanwhile, take a look at open source embedders like Chromium and Envoy to get started:

To contribute to QUICHE, follow instructions at

QUICHE is only supported on little-endian platforms.