Skip to content

Commit b0876f5

Browse files
committed
Fixed: the long connection judgment
1 parent a0407bf commit b0876f5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Server/Response.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,16 @@ public function respond(): void
236236
}
237237

238238
$headerConnection = $this->getHeader('Connection');
239-
if (!$headerConnection || !str_contains(strtolower($headerConnection), 'keep-alive')) {
239+
if (!$headerConnection) {
240240
$this->stream->close();
241+
} else {
242+
if (is_array($headerConnection)) {
243+
$headerConnection = implode(',', $headerConnection);
244+
}
245+
246+
if (!str_contains(strtolower($headerConnection), 'keep-alive')) {
247+
$this->stream->close();
248+
}
241249
}
242250
}
243251

0 commit comments

Comments
 (0)