示例#1
0
 protected function shouldConnectionBeClosed(HttpResponse $response) : bool
 {
     if (!$this->keepAlive) {
         return true;
     }
     if ($response->getProtocolVersion() === '1.0' && !\in_array('keep-alive', $response->getHeaderTokenValues('Connection'), true)) {
         return true;
     }
     if (!$response->hasHeader('Content-Length') && 'chunked' !== \strtolower($response->getHeaderLine('Transfer-Encoding'))) {
         return true;
     }
     return false;
 }