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

Improve HTTP Request line validation #59

Merged
merged 2 commits into from
Jan 20, 2025

Conversation

vbanos
Copy link
Contributor

@vbanos vbanos commented Jan 19, 2025

Refactor isLineStartingWithHTTPMethod to include all the logic that is necessary to validate an HTTP request (prefix and suffix).

Previously, some of the logic was in isLineStartingWithHTTPMethod and some was in dialer.go where the function was used.

Rename it to isHTTPRequest. (IMHO isHTTPRequestLine is redundant as line is the function param.

Add unit tests.

Refactor `isLineStartingWithHTTPMethod` to include all the logic that is
necessary to validate an HTTP request (prefix and suffix).

Previously, some of the logic was in `isLineStartingWithHTTPMethod` and
some was in `dialer.go` where the function was used.

Rename it to `isHTTPRequest`. (IMHO `isHTTPRequestLine` is redundant as
`line` is the function param.

Add unit tests.
Copy link
Owner

@CorentinB CorentinB left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@CorentinB CorentinB merged commit 8539cbe into CorentinB:master Jan 20, 2025
1 check passed
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.

2 participants