From aa693d62cfe4684c8df8f94c4b02b64087ab113d Mon Sep 17 00:00:00 2001 From: Michael Gerzabek Date: Sun, 14 Jan 2024 16:38:29 +0100 Subject: [PATCH] Corrected request header split #775 (#776) --- src/Transaction/MultipartDocument.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Transaction/MultipartDocument.php b/src/Transaction/MultipartDocument.php index 4d5d46304..bf1009d92 100644 --- a/src/Transaction/MultipartDocument.php +++ b/src/Transaction/MultipartDocument.php @@ -121,10 +121,10 @@ public function parseDocuments(): self list($headers, $body) = array_map('trim', explode("\r\n\r\n", $document, 2)); foreach (explode("\r\n", $headers) as $header) { - list($key, $value) = explode(': ', $header, 2); + list($key, $value) = explode(':', $header, 2); $key = strtolower($key); $multipart->headers[$key] = $multipart->headers[$key] ?? []; - $multipart->headers[$key][] = $value; + $multipart->headers[$key][] = trim($value); } $multipart->setBody($body); @@ -176,9 +176,9 @@ public function toRequest(): Request break; } - list($key, $value) = explode(': ', $line, 2); + list($key, $value) = explode(':', $line, 2); - $headers[$key] = $value; + $headers[$key] = trim($value); } $body = implode("\r\n", $httpRequest); @@ -188,4 +188,4 @@ public function toRequest(): Request return $request; } -} \ No newline at end of file +}