| @@ 1123-1141 (lines=19) @@ | ||
| 1120 | ||
| 1121 | $headers['Command'] = explode(' ', $heads[0], 3); |
|
| 1122 | ||
| 1123 | for ($i = 1; $i < count($heads); $i++) { |
|
| 1124 | $header = explode(':', $heads[$i], 2); |
|
| 1125 | if (count($header) > 1) { |
|
| 1126 | $headername = strtolower(trim($header[0])); |
|
| 1127 | if (isset($_wa_header_separator[$headername])) { |
|
| 1128 | $sep = $_wa_header_separator[$headername]; |
|
| 1129 | } else { |
|
| 1130 | $sep = ','; |
|
| 1131 | } |
|
| 1132 | if (isset($_wa_header_multi[$headername]) && $_wa_header_multi[$headername]) { |
|
| 1133 | if (!isset($headers[$headername])) { |
|
| 1134 | $headers[$headername] = array(); |
|
| 1135 | } |
|
| 1136 | $headers[$headername][] = explode($sep, trim($header[1])); |
|
| 1137 | } else { |
|
| 1138 | $headers[$headername] = explode($sep, trim($header[1])); |
|
| 1139 | } |
|
| 1140 | } |
|
| 1141 | } |
|
| 1142 | ||
| 1143 | if (isset($headers['content-length'][0])) { |
|
| 1144 | $headers['content-length'][0] += 0; //convert to int |
|
| @@ 1225-1243 (lines=19) @@ | ||
| 1222 | ||
| 1223 | // add end headers if any |
|
| 1224 | $heads = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $message_end[0]))); |
|
| 1225 | for ($i = 1; $i < count($heads); $i++) { |
|
| 1226 | $header = explode(':', $heads[$i], 2); |
|
| 1227 | if (count($header) > 1) { |
|
| 1228 | $headername = strtolower(trim($header[0])); |
|
| 1229 | if (isset($_wa_header_separator[$headername])) { |
|
| 1230 | $sep = $_wa_header_separator[$headername]; |
|
| 1231 | } else { |
|
| 1232 | $sep = ','; |
|
| 1233 | } |
|
| 1234 | if (isset($_wa_header_multi[$headername]) && $_wa_header_multi[$headername]) { |
|
| 1235 | if (!isset($headers[$headername])) { |
|
| 1236 | $headers[$headername] = array(); |
|
| 1237 | } |
|
| 1238 | $headers[$headername][] = explode($sep, trim($header[1])); |
|
| 1239 | } else { |
|
| 1240 | $headers[$headername] = explode($sep, trim($header[1])); |
|
| 1241 | } |
|
| 1242 | } |
|
| 1243 | } |
|
| 1244 | $this->_spool[0]['Headers'] = $headers; |
|
| 1245 | ||
| 1246 | // remaining buffer for next reply |
|