GaloisInc / daedalus

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

HTTP/1.1 `field-name` rule too restrictive #350

Open kenballus opened 11 months ago

kenballus commented 11 months ago

RFC 9110 defines field-name with the following productions:

field-name = token
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA

We HTTP-1.1.ddl defines it like this:

def Field_name =
  block
    -- Field names must start with an ASCII letter and can include
    -- letters, digits, or '-' characters.
    let head = $alpha
    let tail = Many $[ $alpha | '-' | $digit ]
    let result = concat [[head], tail]
    ^ map (c in result)
        toLower c

To match the RFC, I think it should look more like this:

def Field_name =
  block
    let result = Many $[ '!' | '#' | '$' | '%' | '&' | "'" | '*' | '+' | '-' | '.' | '^' | '_' | '`' | '|' | '~' | $digit | $alpha ]
    ^ map (c in result)
        toLower c

Just wanted to submit an issue before PR, in case there's a place in the spec that I missed that specifies the restrictions implemented in HTTP-1.1.ddl.