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 correctly handle authority-form URIs #330

Closed kenballus closed 1 year ago

kenballus commented 1 year ago

The following HTTP message is from RFC9112, section 3.2.3:

CONNECT www.example.com:80 HTTP/1.1\r\n
Host: www.example.com\r\n
\r\n

This is the RFC's example of the special authority-form URI that's unique to CONNECT requests. I can see on formats/http/HTTP-1.1.ddl:252 that this URI form should be supported, but when I send the request above, it is mistaken for an absolute-form URI:

printf 'CONNECT www.example.com:80 HTTP/1.1\r\nHost: www.example.com\r\n\r\n' | /bin/daedalus run HTTP-1.1.ddl --entry=HTTP_request --input=/dev/stdin --json
[{ "start": { "method": { "$CONNECT": {} }
            , "target": { "$AbsoluteURI": { "scheme": [ 119
                                                      , 119
                                                      , 119
                                                      , 46
                                                      , 101
                                                      , 120
                                                      , 97
                                                      , 109
                                                      , 112
                                                      , 108
                                                      , 101
                                                      , 46
                                                      , 99
                                                      , 111
                                                      , 109
                                                      ]
                                          , "authority": null
                                          , "rootless": true
                                          , "path": [ [ 56
                                                      , 48
                                                      ] ]
                                          , "query": null
                                          } }
            , "version": { "major": 1
                         , "minor": 1
                         }
            }
 , "field_info": { "fields": [ { "$Field": { "name": [ 104
                                                     , 111
                                                     , 115
                                                     , 116
                                                     ]
                                           , "value": [ 119
                                                      , 119
                                                      , 119
                                                      , 46
                                                      , 101
                                                      , 120
                                                      , 97
                                                      , 109
                                                      , 112
                                                      , 108
                                                      , 101
                                                      , 46
                                                      , 99
                                                      , 111
                                                      , 109
                                                      ]
                                           } } ]
                 , "chunked": false
                 , "explicit_length": null
                 , "encoded": false
                 }
 , "body": { "$bytes": [] }
 }]