public function prepareResponse($result)
    {
        $response = ['header' => null, 'content' => null];
        $d = "\r\n\r\n"; // Headers and content delimiter

        if (is_string($result) && strpos($result, $d) !== false) {
            list($header, $content) = explode($d, $result, 2);
            if (stripos($header, '100 Continue') !== false && strpos($content, $d) !== false) {
                list($header, $content) = explode($d, $content, 2);
            }
            $response['header'] = $header;
            $response['content'] = htmlentities($content);
        }

        return $response;
    }