protected function sendResponseHeadersToClient(WebRequest $request, $code, $message)
    {
        $headers = [
            "Date"       => gmdate("D, d M Y H:i:s T"),
            "Connection" => "close"
        ];
        
        $bytes = $this->sendToClient($request->getVersion() . " {$code} {$message}\r\n");
        foreach($headers as $header => $value) {
            $bytes += $this->sendToClient("{$header}: {$value}\r\n");
        }
        $bytes += $this->sendToClient("\r\n");
        
        return $bytes;
    }