Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/HTTP/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function send(string $method, string $url)
// Set the string we want to break our response from
$breakString = "\r\n\r\n";

if (strpos($output, 'HTTP/1.1 100 Continue') === 0) {
while (strpos($output, 'HTTP/1.1 100 Continue') === 0) {
$output = substr($output, strpos($output, $breakString) + 4);
}

Expand Down
26 changes: 26 additions & 0 deletions tests/system/HTTP/CURLRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,4 +1109,30 @@ public function testUserAgentOption(): void
$this->assertArrayHasKey(CURLOPT_USERAGENT, $options);
$this->assertSame($agent, $options[CURLOPT_USERAGENT]);
}

/**
* @see https://github.com/codeigniter4/CodeIgniter4/issues/8347
*/
public function testMultipleHTTP100(): void
{
$jsonBody = '{"name":"John Doe","age":30}';

$output = "HTTP/1.1 100 Continue
Mark bundle as not supporting multiuse
HTTP/1.1 100 Continue
Mark bundle as not supporting multiuse
HTTP/1.1 200 OK
Server: Werkzeug/2.2.2 Python/3.7.17
Date: Sun, 28 Jan 2024 06:05:36 GMT
Content-Type: application/json
Content-Length: 33\r\n\r\n" . $jsonBody;

$this->request->setOutput($output);

$response = $this->request->request('GET', 'http://example.com');

$this->assertSame($jsonBody, $response->getBody());

$this->assertSame(200, $response->getStatusCode());
}
}