Skip to content

Commit

Permalink
Use already set $method
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonbennett committed Mar 3, 2022
1 parent 8012be0 commit 04d5e75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Io/StreamingServer.php
Expand Up @@ -265,7 +265,7 @@ public function handleResponse(ConnectionInterface $connection, ServerRequestInt
if (($method === 'CONNECT' && $code >= 200 && $code < 300) || ($code >= 100 && $code < 200) || $code === Response::STATUS_NO_CONTENT) {
// 2xx response to CONNECT and 1xx and 204 MUST NOT include Content-Length or Transfer-Encoding header
$response = $response->withoutHeader('Content-Length');
} elseif ($request->getMethod() === 'HEAD' && $response->hasHeader('Content-Length')) {
} elseif ($method === 'HEAD' && $response->hasHeader('Content-Length')) {
// HEAD Request: preserve explicit Content-Length
} elseif ($code === Response::STATUS_NOT_MODIFIED && ($response->hasHeader('Content-Length') || $body->getSize() === 0)) {
// 304 Not Modified: preserve explicit Content-Length and preserve missing header if body is empty
Expand Down

0 comments on commit 04d5e75

Please sign in to comment.