Skip to content

Commit ce92b11

Browse files
committed
Fix the headers mapping
1 parent 5ad9b26 commit ce92b11

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PSR7Worker.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ protected function mapRequest(Request $httpRequest, array $server): ServerReques
188188
}
189189

190190
foreach ($httpRequest->headers as $name => $value) {
191-
$request = $request->withHeader($name, $value);
191+
try {
192+
$request = $request->withHeader($name, $value);
193+
} catch (\InvalidArgumentException $e) {
194+
// ignore invalid header names or values (otherwise, the worker will be crashed)
195+
// @see: Nyholm/psr7 <https://git.io/JzjgJ>
196+
}
192197
}
193198

194199
if ($httpRequest->parsed) {

0 commit comments

Comments
 (0)