Nyholm / psr7

A super lightweight PSR-7 implementation
MIT License
1.15k stars 75 forks source link

Encode userinfo (but don't double-encode) #213

Closed nicolas-grekas closed 1 year ago

nicolas-grekas commented 1 year ago

Fix #206

Yes, this is unspecified by the PSR, but the current behavior produces broken URLs, and other mainstream implementations do the same: encoding characters that must be, while preventing double-encoding. I think this makes sense. It's more useful than an exception.

dbu commented 1 year ago

if i understand correctly, PSR7 is a bit underspecified in that regard. would it be possible to amend PSR-7 to make it the official behaviour? maybe with a SHOULD for the current version and a MUST for a new major version?

nicolas-grekas commented 1 year ago

That could be a path forward for PSR-7 yes @dbu. For now, I'm advising ppl to contribute these edge cases to https://github.com/php-http/psr7-integration-tests/. Like with https://github.com/php-cache/integration-tests/, this would give a reference test suite to validate implementations, and spot+define behaviors for unspecified cases.