Make WordPress Core

Ticket #9395: 9395.diff

File 9395.diff, 1.3 KB (added by Denis-de-Bernardy, 16 years ago)
  • wp-includes/http.php

     
    403403
    404404                $cookies = array();
    405405                $newheaders = array();
     406
     407                // first, process the HTTP status line
     408                if ( false === strpos($headers[0], ':') ) {
     409                        $tempheader = array_shift($headers);
     410                        list( , $response_code, $response_msg) = explode(' ', $tempheader, 3);
     411                        $response['code'] = $response_code;
     412                        $response['message'] = $response_msg;
     413                }
     414
     415                // combine any headers split over multiple lines
     416                if ( sizeof($headers) > 2 )
     417                        for ( $i=(sizeof($headers)-1); $i>=0; $i-- ) {
     418                                $c = substr($headers[$i], 0, 1);
     419                                if ($c == ' ' || $c == "\t") {
     420                                        $headers[$i-1] = rtrim($headers[$i-1]) . ' ' . ltrim($headers[$i]);
     421                                        unset($headers[$i]);
     422                                }
     423                        }
     424
    406425                foreach ( $headers as $tempheader ) {
    407426                        if ( empty($tempheader) )
    408427                                continue;
    409428
    410                         if ( false === strpos($tempheader, ':') ) {
    411                                 list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3);
    412                                 $response['code'] = $iResponseCode;
    413                                 $response['message'] = $strResponseMsg;
    414                                 continue;
    415                         }
    416 
    417429                        list($key, $value) = explode(':', $tempheader, 2);
    418430
    419431                        if ( !empty( $value ) ) {