Make WordPress Core

Ticket #9395: http.diff

File http.diff, 1.2 KB (added by wnorris, 16 years ago)
  • http.php

     
    404404
    405405                $cookies = array();
    406406                $newheaders = array();
     407
     408                // first, process the HTTP status line
     409                if ( false === strpos($headers[0], ':') ) {
     410                        $tempheader = array_shift($headers);
     411                        list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3);
     412                        $response['code'] = $iResponseCode;
     413                        $response['message'] = $strResponseMsg;
     414                }
     415
     416                // combine any headers split over multiple lines
     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
    407425                foreach ( $headers as $tempheader ) {
    408426                        if ( empty($tempheader) )
    409427                                continue;
    410428
    411                         if ( false === strpos($tempheader, ':') ) {
    412                                 list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3);
    413                                 $response['code'] = $iResponseCode;
    414                                 $response['message'] = $strResponseMsg;
    415                                 continue;
    416                         }
    417 
    418429                        list($key, $value) = explode(':', $tempheader, 2);
    419430
    420431                        if ( !empty( $value ) ) {