Skip to content

Conversation

karenetheridge
Copy link
Contributor

@karenetheridge karenetheridge commented Feb 24, 2025

RFC9112 §3.2-5 says that Host is mandatory, but can be an empty value.

resolves issue #2232.

@karenetheridge
Copy link
Contributor Author

Looks like perltidy needs to be run in main? Or has the tidyrc been changed?

@kraih
Copy link
Member

kraih commented Feb 25, 2025

Rebase on main.

@karenetheridge
Copy link
Contributor Author

rebased.

@karenetheridge
Copy link
Contributor Author

can someone review this please?

Copy link
Member

@christopherraa christopherraa left a 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';
Copy link
Member

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

@kraih kraih requested review from a team, Copilot, marcusramberg, kraih, jhthorsen and jberger June 6, 2025 12:07
Copilot

This comment was marked as outdated.

RFC9112 §3.2-5 says that Host is mandatory, but can be an empty value.
resolves issue mojolicious#2232.
@karenetheridge
Copy link
Contributor Author

rebased to new commits in master, and s/url/URL/ fixed. re-ran perltidy with no formatting changes from before.

Copy link
Member

@christopherraa christopherraa left a 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.

@kraih kraih requested a review from Copilot June 7, 2025 02:13
Copy link

@Copilot Copilot AI left a 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.

@mergify mergify bot merged commit 8f5bca9 into mojolicious:main Jun 7, 2025
11 checks passed
@karenetheridge karenetheridge deleted the ether/missing-host branch June 7, 2025 04:12
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.

3 participants