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

feat: basic but generic http parser #69

Merged
merged 5 commits into from
Aug 30, 2024
Merged

Conversation

Autoparallel
Copy link
Contributor

This HTTP parsing can tell you when you are on the start line, in headers, or in the body. It does so with 3 flags:

  • parsing_start: Equals 1 if we are parsing the start line (either method / status), 0 otherwise.
  • parsing_header: Equals 1 if we are parsing headers, 0 otherwise.
  • parsing_body: Equals 1 if we are parsing body, 0 otherwise.

Tested this with the circuits:

    "get_request": {
        "file": "http/parser/parser",
        "template": "Parser",
        "params": [60]
    },
    "get_response": {
        "file": "http/parser/parser",
        "template": "Parser",
        "params": [89]
    }

You can get the necessary witness files by running:

witness http --input-file examples/http/get_request.http --output-dir inputs/get_request --output-filename input.json
witness http --input-file examples/http/get_response.http --output-dir inputs/get_response --output-filename input.json

Note, I had to do some jank in the rust witnessgen that prepends a CL char since I couldn't get this in the file another way. However that works for now!


Closes #58

Copy link
Collaborator

@lonerapier lonerapier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cooking never ends!!

circuits/http/parser/machine.circom Outdated Show resolved Hide resolved
circuits/http/parser/language.circom Show resolved Hide resolved
@Autoparallel Autoparallel merged commit 5d6aac5 into main Aug 30, 2024
1 check passed
@Autoparallel Autoparallel deleted the feat/generic-http-parser branch August 30, 2024 17:41
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

Successfully merging this pull request may close these issues.

feat(http): parse into "zones": method, status, headers, body
2 participants