From 0b1da8f7135692368a66c80d40914a40227ee9eb Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 12 Jun 2024 12:34:51 +0100 Subject: [PATCH] fix: stream --- src/Orchestration/Adapter/DockerAPI.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Orchestration/Adapter/DockerAPI.php b/src/Orchestration/Adapter/DockerAPI.php index 81c808d..619b686 100644 --- a/src/Orchestration/Adapter/DockerAPI.php +++ b/src/Orchestration/Adapter/DockerAPI.php @@ -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);