Make WordPress Core

Ticket #9395: 9395.patch

File 9395.patch, 939 bytes (added by hakre, 16 years ago)

The RFC is not that complex. (Fixed)

  • wp-includes/http.php

     
    396396         *                                      Then a numbered array is returned as the value of that header-key.
    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' => '');
    403410