Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support parsing HTTP/1.1 request sequences #339

Open
kenballus opened this issue Jul 27, 2023 · 3 comments
Open

Feature Request: Support parsing HTTP/1.1 request sequences #339

kenballus opened this issue Jul 27, 2023 · 3 comments

Comments

@kenballus
Copy link

HTTP-1.1.ddl currently parses only the first request in its input, which means that we can't use it to parse pipelined requests. If there were a field in the Daedalus JSON output that reports how many bytes of input were consumed, then I could use the single request parser to implement request stream parsing.

@kenballus kenballus changed the title Feature Request: Add count of input bytes consumed to Daedalus output Feature Request: Support parsing HTTP/1.1 request sequences Jul 30, 2023
@kenballus
Copy link
Author

Update: I can see that requests containing unknown Transfer-Encodings have a "$remaining" field in their body objects that contains the remaining bytes after parsing. Implementing this whenever there are bytes left after parsing would also work for me.

Another solution would be to extend the grammar to support request sequences.

@yav
Copy link
Member

yav commented Sep 21, 2023

@kenballus I am not sure how exactly you interface with HTTP-1.1.ddl, do you just run it with daedalus and you provide an entry parser? If so, the change should be pretty simple---here are a few options, perhaps you can try them out locally and I'd be happy to commit whichever you find useful:

A parser that would parse many requests one after the next (returns a sequence of requests):

def HTTP_requests = Many HTTP_request

A parser that returns the HTTP request, and also the offset after the last consumed byte:

def RequestWithOffset =                                                                       
  block                                                                          
    request = HTTP_request                                                       
    offset  = Offset

Parse a request, and also return the bytes after it:

def RequestWithBytes =
  block
     request = HTTP_request
     remaining = Many $any

@kenballus
Copy link
Author

do you just run it with daedalus and you provide an entry parser?

We sure do!

I think option 2 is best, so good requests are parsed correctly even when followed by malformed requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants