silk.http.http2_headers.

HTTP/2 field validation for requests, responses, and trailers under RFC 9113 section 8.

Import as Message with import silk.http.http2_headers { Message }.

Public declarations: 4.

Section#

silk
pub enum Section

The expected field section type.

Request#

silk
Request

Initial request fields, including request pseudo-headers.

Response#

silk
Response

Informational or final response fields, including :status.

Trailers#

silk
Trailers

Trailing fields, without pseudo-headers.

Message#

silk
pub struct Message

Message properties needed for body validation.

Field hasLength#

silk
pub hasLength: bool

True if Content-Length is present.

Field length#

silk
pub length: u64

The declared body length, or zero if absent.

Field status#

silk
pub status: u32

Response status, or zero for requests and trailers.

Field head#

silk
pub head: bool

True for a HEAD request.

Field connect#

silk
pub connect: bool

True for a CONNECT request.

Implementation Copy for Message#

silk
impl Copy for Message

validate#

silk
pub effect<'call> fn validate<'call, 'data: 'call>(
  fields: &'call [Field<'data>],
  section: Section,
  stream: u32
) -> Message
  ! ProtocolError

Validates one complete decoded field section. Violations are stream PROTOCOL_ERRORs. It rejects invalid bytes, pseudo-header order and duplicates, connection fields, and conflicting Content-Length values.

validateExcept#

silk
pub effect<'call> fn validateExcept<'call, 'data: 'call>(
  fields: &'call [Field<'data>],
  section: Section,
  stream: u32,
  checked: &[u8]
) -> Message
  ! ProtocolError

Validates like validate, except that an :authority equal to checked is not parsed again. Pass an authority that an earlier validation accepted, such as the one of the previous request on the connection. An empty checked matches nothing. A CONNECT request and a request with a Host field always have their authority parsed.

Category: HTTP.

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2, x86_64-pc-windows-msvc, wasm64-unknown-unknown.

View the source of this page