Skip to content

Commit f7cc057

Browse files
committed
fix: strip out multiple header sections for redirect
1 parent 3a04112 commit f7cc057

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

system/HTTP/CURLRequest.php

+6
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ public function send(string $method, string $url)
385385
// Set the string we want to break our response from
386386
$breakString = "\r\n\r\n";
387387

388+
if (isset($this->config['allow_redirects']) && $this->config['allow_redirects'] !== false) {
389+
while (preg_match('/^HTTP\/\d(?:\.\d)? (?:301|302|307|308)/', $output)) {
390+
$output = substr($output, strpos($output, $breakString) + 4);
391+
}
392+
}
393+
388394
while (str_starts_with($output, 'HTTP/1.1 100 Continue')) {
389395
$output = substr($output, strpos($output, $breakString) + 4);
390396
}

0 commit comments

Comments
 (0)