399 | | if ( is_string($headers) ) |
400 | | $headers = explode("\n", str_replace(array("\r\n", "\r"), "\n", $headers) ); |
| 399 | // split headers, one per array element |
| 400 | if ( is_string($headers) ) { |
| 401 | // tolerate line terminator: CRLF = LF (RFC 2616 19.3) |
| 402 | $headers = str_replace("\r\n", "\n"); |
| 403 | // unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2) |
| 404 | $headers = preg_replace('\n[ \t]', ' ', $headers); |
| 405 | // create the headers array |
| 406 | $headers = explode("\n", $headers); |
| 407 | } |