Skip to content

Commit 439032b

Browse files
Merge branch '6.4' into 7.3
* 6.4: [HttpClient] Reject 3xx pushed responses [ProxyManagerBridge] Remove comment that reference github discussion [Routing] Fix matching the "0" URL The BrowserKit history with parameter separator without slash.
2 parents 4b62871 + 738bc9d commit 439032b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CurlHttpClient.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ private static function acceptPushForRequest(string $method, array $options, Pus
384384
}
385385
}
386386

387-
return true;
387+
$statusCode = $pushedResponse->response->getInfo('http_code') ?: 200;
388+
389+
return $statusCode < 300 || 400 <= $statusCode;
388390
}
389391

390392
/**

Response/CurlResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
408408
$info['peer_certificate_chain'] = array_map('openssl_x509_read', array_column($certinfo, 'Cert'));
409409
}
410410

411-
if (300 <= $info['http_code'] && $info['http_code'] < 400) {
411+
if (300 <= $info['http_code'] && $info['http_code'] < 400 && null !== $options) {
412412
if (curl_getinfo($ch, \CURLINFO_REDIRECT_COUNT) === $options['max_redirects']) {
413413
curl_setopt($ch, \CURLOPT_FOLLOWLOCATION, false);
414414
} elseif (303 === $info['http_code'] || ('POST' === $info['http_method'] && \in_array($info['http_code'], [301, 302], true))) {
@@ -430,7 +430,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
430430

431431
$info['redirect_url'] = null;
432432

433-
if (300 <= $statusCode && $statusCode < 400 && null !== $location) {
433+
if (300 <= $statusCode && $statusCode < 400 && null !== $location && null !== $options) {
434434
if ($noContent = 303 === $statusCode || ('POST' === $info['http_method'] && \in_array($statusCode, [301, 302], true))) {
435435
$info['http_method'] = 'HEAD' === $info['http_method'] ? 'HEAD' : 'GET';
436436
curl_setopt($ch, \CURLOPT_CUSTOMREQUEST, $info['http_method']);
@@ -445,7 +445,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
445445

446446
if (401 === $statusCode && isset($options['auth_ntlm']) && 0 === strncasecmp($headers['www-authenticate'][0] ?? '', 'NTLM ', 5)) {
447447
// Continue with NTLM auth
448-
} elseif ($statusCode < 300 || 400 <= $statusCode || null === $location || curl_getinfo($ch, \CURLINFO_REDIRECT_COUNT) === $options['max_redirects']) {
448+
} elseif ($statusCode < 300 || 400 <= $statusCode || null === $location || null === $options || curl_getinfo($ch, \CURLINFO_REDIRECT_COUNT) === $options['max_redirects']) {
449449
// Headers and redirects completed, time to get the response's content
450450
$multi->handlesActivity[$id][] = new FirstChunk();
451451

0 commit comments

Comments
 (0)