19 if (isset($parts[
'start_line'][2])) {
20 $startParts = explode(
'/', $parts[
'start_line'][2]);
21 $protocol = strtoupper($startParts[0]);
22 $version = isset($startParts[1]) ? $startParts[1] :
'1.1';
29 'method' => strtoupper($parts[
'start_line'][0]),
30 'protocol' => $protocol,
31 'version' => $version,
32 'headers' => $parts[
'headers'],
33 'body' => $parts[
'body']
36 $parsed[
'request_url'] = $this->
getUrlPartsFromMessage(isset($parts[
'start_line'][1]) ? $parts[
'start_line'][1] :
'' , $parsed);
48 list($protocol, $version) = explode(
'/', trim($parts[
'start_line'][0]));
51 'protocol' => $protocol,
52 'version' => $version,
53 'code' => $parts[
'start_line'][1],
54 'reason_phrase' => isset($parts[
'start_line'][2]) ? $parts[
'start_line'][2] :
'',
55 'headers' => $parts[
'headers'],
56 'body' => $parts[
'body']
74 $lines = preg_split(
'/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
75 for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
81 if ($i < $totalLines - 1) {
82 $body = implode(
'', array_slice($lines, $i + 2));
89 $startLine = explode(
' ', $line, 3);
90 } elseif (strpos($line,
':')) {
91 $parts = explode(
':', $line, 2);
92 $key = trim($parts[0]);
93 $value = isset($parts[1]) ? trim($parts[1]) :
'';
94 if (!isset($headers[$key])) {
95 $headers[$key] = $value;
96 } elseif (!is_array($headers[$key])) {
97 $headers[$key] = array($headers[$key], $value);
99 $headers[$key][] = $value;
105 'start_line' => $startLine,
106 'headers' => $headers,