bug #35324 [HttpClient] Fix strict parsing of response status codes (Armando-Walmeric)
This PR was submitted for the master branch but it was squashed and merged into the 4.3 branch instead.
Discussion
----------
[HttpClient] Fix strict parsing of response status codes
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | No ticket opened
| License | MIT
| Doc PR | No new feature
If you wait a strict Http code response by the server were you request, but the server response isn't strict and only return HTTP/1.1 200 we have a problem without sense to be strict on regular expression.
Commits
-------
4aa953600f
[HttpClient] Fix strict parsing of response status codes
This commit is contained in:
commit
ec0333c081
@ -223,7 +223,7 @@ trait ResponseTrait
|
|||||||
private static function addResponseHeaders(array $responseHeaders, array &$info, array &$headers, string &$debug = ''): void
|
private static function addResponseHeaders(array $responseHeaders, array &$info, array &$headers, string &$debug = ''): void
|
||||||
{
|
{
|
||||||
foreach ($responseHeaders as $h) {
|
foreach ($responseHeaders as $h) {
|
||||||
if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([12345]\d\d) .*#', $h, $m)) {
|
if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([12345]\d\d)(?: |$)#', $h, $m)) {
|
||||||
if ($headers) {
|
if ($headers) {
|
||||||
$debug .= "< \r\n";
|
$debug .= "< \r\n";
|
||||||
$headers = [];
|
$headers = [];
|
||||||
|
Reference in New Issue
Block a user