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

Normalize line-folded headers values to not contain newlines #87

Merged
merged 1 commit into from
May 4, 2022

Conversation

TimWolla
Copy link
Contributor

@TimWolla TimWolla commented May 4, 2022

Q A
Documentation no
Bugfix yes
BC Break maybe?
New Feature no
RFC no
QA no

Description

As per RFC 7230#3.2.4:

A server that receives an obs-fold in a request message that is not
within a message/http container MUST […] replace
each received obs-fold with one or more SP octets prior to
interpreting the field value or forwarding the message downstream.
[…]
A user agent that receives an obs-fold in a response message that is
not within a message/http container MUST replace each received
obs-fold with one or more SP octets prior to interpreting the field
value.

Furthermore this change improves interoperability with PSR-7 implementations
that reject line folding.

The updated behavior matches the suggested behavior with regard to the handling
of line-folding in the new php-fig/fig-standards#1274 erratum.

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

LGTM. @weierophinney can you have a second look?

@Ocramius Ocramius added the Bug Something isn't working label May 4, 2022
@Ocramius Ocramius added this to the 2.10.0 milestone May 4, 2022
As per RFC 7230#3.2.4:

> A server that receives an obs-fold in a request message that is not
> within a message/http container MUST […] replace
> each received obs-fold with one or more SP octets prior to
> interpreting the field value or forwarding the message downstream.
> […]
> A user agent that receives an obs-fold in a response message that is
> not within a message/http container MUST replace each received
> obs-fold with one or more SP octets prior to interpreting the field
> value.

Furthermore this change improves interoperability with PSR-7 implementations
that reject line folding.

The updated behavior matches the suggested behavior with regard to the handling
of line-folding in the new php-fig/fig-standards#1274 erratum.

Signed-off-by: Tim Düsterhus <duesterhus@woltlab.com>
@TimWolla
Copy link
Contributor Author

TimWolla commented May 4, 2022

Rebased to add the missing use function, see #88. I've also rebased onto 2.9.x to make it easier for you to pick into 2.9.x if you desire to do so.

@Ocramius
Copy link
Member

Ocramius commented May 4, 2022

IMO OK for 2.10.x

@TimWolla
Copy link
Contributor Author

TimWolla commented May 4, 2022

IMO OK for 2.10.x

I'm fine either way. This is a fix for an obscure corner case of the HTTP spec and not something users will encounter in the real world.

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

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

🚢

Thanks for the stellar errata for PSR-7, @TimWolla !

@weierophinney weierophinney merged commit a3f03b3 into laminas:2.10.x May 4, 2022
@TimWolla TimWolla deleted the normalize-line-folding branch May 4, 2022 15:17
@TimWolla
Copy link
Contributor Author

TimWolla commented May 4, 2022

Thanks for the stellar errata for PSR-7, @TimWolla !

My pleasure. Thanks from my side for Diactoros and also for the super nice and speedy handling of my PRs 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants