-
Notifications
You must be signed in to change notification settings - Fork 584
fix_headers() now initializes Host header when needed #2234
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
Conversation
Looks like perltidy needs to be run in main? Or has the tidyrc been changed? |
Rebase on main. |
b872ef8
to
71c6823
Compare
rebased. |
can someone review this please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally this looks good to me. No objections these. I only had one question with regards to consistency in alignment. If some of the more senior members of mojo thinks this is unimportant then I have no issue changing this review to an approval.
t/mojo/request.t
Outdated
is $req->headers->host, undef, '"Host" value is not defined'; | ||
|
||
$req->fix_headers; | ||
is $req->url->host, undef, 'still no url host'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nitpick, but I see that the rest of the file is mostly has alignment of the expected values and the test description. Perhaps align these two as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it's URL
, not url
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change url
to URL
, but the formatting is purely what perltidy produced.
RFC9112 §3.2-5 says that Host is mandatory, but can be an empty value. resolves issue mojolicious#2232.
71c6823
to
2870a46
Compare
rebased to new commits in master, and s/url/URL/ fixed. re-ran perltidy with no formatting changes from before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 from me since the perltidy check doesn't complain on the formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that the Host header is properly initialized to an empty string when it is not defined, in accordance with RFC9112 §3.2-5.
- Added tests in t/mojo/request.t to validate fix_headers behavior for the Host header.
- Updated the fix_headers method in lib/Mojo/Message/Request.pm to set the Host header to an empty string if undefined.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
t/mojo/request.t | Added tests verifying that fix_headers correctly sets Host. |
lib/Mojo/Message/Request.pm | Modified fix_headers to initialize the Host header as needed. |
RFC9112 §3.2-5 says that Host is mandatory, but can be an empty value.
resolves issue #2232.