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

Addition of Http Parser #3103

Merged
merged 11 commits into from
Jul 28, 2023
Merged

Addition of Http Parser #3103

merged 11 commits into from
Jul 28, 2023

Conversation

bleaphar
Copy link
Contributor

This is the beginning of a package to tokenize and parse htttp requests.

jonsequitur and others added 7 commits July 13, 2023 11:27
Includes some code clean up to fix up warnings (mainly around nullable annotations).

Also moves reference parser implementation into a sub-folder.
Add support for parsing leading trivia.
The additions in this file make it possible to put in just a url as a valid request node
Also the addition of a lexer test
{
[Fact]

public void multiple_whitespaces_are_treated_as_a_single_token()
Copy link
Contributor

@shyamnamboodiripad shyamnamboodiripad Jul 26, 2023

Choose a reason for hiding this comment

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

Please add similar tokenization tests for the other token kinds listed in the TODO comment above.

For example, punctuation should always be split into separate tokens, newline chars should always be split into separate tokens (except when it is \r followed by \n), and words should always be combined into a single token.

The tokenization test for newlines would also address Jon's comment above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the tests for whitespace, newline and punctuation are now in place. It would be great to add one for "words should always be combined into a single token" so that we round out all the kinds of tokens that the lexer produces.

Content-Type:application/json
#comment
Accept: gzip
""";
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should work now, should it not? The comment will be added as leading trivia for the header.

}

[Fact]
public async Task BodyAfterCommentAsync()
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should work now, should it not? The comment should be added as leading trivia for the body.

Copy link
Contributor

@shyamnamboodiripad shyamnamboodiripad left a comment

Choose a reason for hiding this comment

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

LGTM modulo comments 👍🏾

@bleaphar
Copy link
Contributor Author

Merging

@bleaphar bleaphar closed this Jul 28, 2023
@bleaphar bleaphar reopened this Jul 28, 2023
@jonsequitur jonsequitur merged commit e6663b8 into dotnet:main Jul 28, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants