Skip to content

Commit

Permalink
fix: stream
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Jun 12, 2024
1 parent b000056 commit 0b1da8f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Orchestration/Adapter/DockerAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,19 @@ protected function call(string $url, string $method, $body = null, array $header
*/
protected function streamCall(string $url, int $timeout = -1): array
{
$body = \json_encode([
'Detach' => false,
]);
$body = \json_encode(['Detach' => false]);

$ch = \curl_init();
\curl_setopt($ch, CURLOPT_URL, $url);
\curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, '/var/run/docker.sock');
\curl_setopt($ch, CURLOPT_POST, 1);
\curl_setopt($ch, CURLOPT_POSTFIELDS, $body); // body is required
\curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$headers = [
'Content-Type: application/json',
'Content-Length: 2',
'host: null',
'Content-Length: '.\strlen($body),
'Host: utopia-php', // Fix Swoole headers bug with socket requests
];
\curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

Expand Down

0 comments on commit 0b1da8f

Please sign in to comment.