Make WordPress Core

Changeset 11351


Ignore:
Timestamp:
05/16/2009 02:17:55 AM (18 years ago)
Author:
ryan
Message:

Support headers split over multiple lines. Props hakre, Denis-de-Bernardy, wnorris. fixes #9395

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/http.php

    r11271 r11351  
    397397         */
    398398        function processHeaders($headers) {
    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                }
    401408
    402409                $response = array('code' => 0, 'message' => '');
Note: See TracChangeset for help on using the changeset viewer.