Skip to content

Conversation

@Qard
Copy link
Member

@Qard Qard commented Mar 26, 2025

This is a refactor of #2 to instead use ext-php-rs as it is a lot easier to get it to build correctly and gives us more flexibility to support dynamic loaded extensions.

@Qard Qard added the enhancement New feature or request label Mar 26, 2025
@Qard Qard force-pushed the ext-php-rs-refactor branch 2 times, most recently from 6b72a19 to 09f540c Compare March 26, 2025 16:20
{
match self.0.get(key.as_ref()) {
Some(Header::Single(value)) => Some(value.clone()),
Some(Header::Multiple(values)) => values.last().cloned(),

Choose a reason for hiding this comment

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

not sure it is correct, I'm sure for some headers, for example Cache-control in response, they should be listed comma separated

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, at the moment this is leaving that up to the user. They can do get to get the last header, assuming only one matters. They can do get_all when they want an array of values, useful when needing to treat them as separate lines like with Cookies, and they can use get_line to get the headers joined into one comma-separated string, which is what the spec says is the only valid way to have multiple values in one string, but with the exception that any headers which already contain a comma (such as Cookies) may need special parsing and so are generally not recommended to use in that way as servers may not parse the header line correctly.

I opted for manual control here rather than encoding all the rules directly into the Headers type, which would be complicated and add maintenance burden to keep it updated, plus would not include any understanding of custom/non-standard headers. Just seemed like a better choice to leave it up to the user and suggest a default in the doc comments.

@simone-sanfratello
Copy link

I left some comments, but maybe at this stage are not important, feel free to ignore them

A-M-A-Z-I-N-G

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Wow!

@mcollina
Copy link
Member

once CI is passing :)

@Qard Qard force-pushed the ext-php-rs-refactor branch 3 times, most recently from cc058e5 to 7cad525 Compare April 11, 2025 14:06
@Qard Qard force-pushed the ext-php-rs-refactor branch 11 times, most recently from 641d0a4 to e7353ea Compare April 21, 2025 11:49
@Qard Qard force-pushed the ext-php-rs-refactor branch 3 times, most recently from 1bf1296 to 2adb1e4 Compare May 8, 2025 10:09
@Qard Qard force-pushed the ext-php-rs-refactor branch from 70d676b to 8ff5fb0 Compare May 8, 2025 11:02
@Qard Qard force-pushed the ext-php-rs-refactor branch from 8ff5fb0 to 99861c8 Compare May 8, 2025 11:05
@Qard Qard merged commit 5198d3c into main May 8, 2025
10 checks passed
@Qard Qard deleted the ext-php-rs-refactor branch May 8, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants