GaloisInc / daedalus

The Daedalus data description language
BSD 3-Clause "New" or "Revised" License
63 stars 11 forks source link

HTTP-1.1 grammar doesn't handle `chunk-ext` for the last chunk #331

Closed kenballus closed 1 year ago

kenballus commented 1 year ago

From RFC 9112, section 7.1:

  chunked-body   = *chunk last-chunk trailer-section CRLF
  chunk          = chunk-size [ chunk-ext ] CRLF chunk-data CRLF
  chunk-size     = 1*HEXDIG
  last-chunk     = 1*("0") [ chunk-ext ] CRLF
  chunk-data     = 1*OCTET ; a sequence of chunk-size octets

...

chunk-ext      = *( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val ] )
chunk-ext-name = token
chunk-ext-val  = token / quoted-string

The Daedalus grammar currently rejects any messages containing chunk extensions on the last chunk. Since the standard allows them, we should too.

EDIT: I initially thought that no chunk-extensions were parsed at all, but I was mistaken. Issue updated to reflect the actual state of things.