public function _interpretHeaders()
    {
        // Parse the Content-Type and charset
        $content_type = isset($this->headers['Content-Type']) ? $this->headers['Content-Type'] : '';
        $content_type = explode(';', $content_type);

        $this->content_type = $content_type[0];
        if (count($content_type) == 2 && strpos($content_type[1], '=') !== false) {
            list($nill, $this->charset) = explode('=', $content_type[1]);
        }

        // RFC 2616 states "text/*" Content-Types should have a default
        // charset of ISO-8859-1. "application/*" and other Content-Types
        // are assumed to have UTF-8 unless otherwise specified.
        // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1
        // http://www.w3.org/International/O-HTTP-charset.en.php
        if (!isset($this->charset)) {
            $this->charset = substr($this->content_type, 5) === 'text/' ? 'iso-8859-1' : 'utf-8';
        }

        // Is vendor type? Is personal type?
        if (strpos($this->content_type, '/') !== false) {
            list($type, $sub_type) = explode('/', $this->content_type);
            $this->is_mime_vendor_specific = substr($sub_type, 0, 4) === 'vnd.';
            $this->is_mime_personal = substr($sub_type, 0, 4) === 'prs.';
        }

        // Parent type (e.g. xml for application/vnd.github.message+xml)
        $this->parent_type = $this->content_type;
        if (strpos($this->content_type, '+') !== false) {
            list($vendor, $this->parent_type) = explode('+', $this->content_type, 2);
            $this->parent_type = Mime::getFullMime($this->parent_type);
        }
    }
public function _interpretHeaders()
    {
        // Parse the Content-Type and charset
        $content_type = isset($this->headers['Content-Type']) ? $this->headers['Content-Type'] : '';
        $content_type = explode(';', $content_type);

        $this->content_type = $content_type[0];
        if (count($content_type) == 2 && strpos($content_type[1], '=') !== false) {
            list($nill, $this->charset) = explode('=', $content_type[1]);
        }

        // RFC 2616 states "text/*" Content-Types should have a default
        // charset of ISO-8859-1. "application/*" and other Content-Types
        // are assumed to have UTF-8 unless otherwise specified.
        // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1
        // http://www.w3.org/International/O-HTTP-charset.en.php
        if (!isset($this->charset)) {
            $this->charset = substr($this->content_type, 5) === 'text/' ? 'iso-8859-1' : 'utf-8';
        }

        // Is vendor type? Is personal type?
        if (strpos($this->content_type, '/') !== false) {
            list($type, $sub_type) = explode('/', $this->content_type);
            $this->is_mime_vendor_specific = substr($sub_type, 0, 4) === 'vnd.';
            $this->is_mime_personal = substr($sub_type, 0, 4) === 'prs.';
        }

        // Parent type (e.g. xml for application/vnd.github.message+xml)
        $this->parent_type = $this->content_type;
        if (strpos($this->content_type, '+') !== false) {
            list($vendor, $this->parent_type) = explode('+', $this->content_type, 2);
            $this->parent_type = Mime::getFullMime($this->parent_type);
        }
    }
public function _interpretHeaders ( ) { // Parse the Content-Type and charset $ content_type = isset ( $ this -> headers [ 'Content-Type' ] ) ? $ this -> headers [ 'Content-Type' ] : '' ; $ content_type = explode ( ';' , $ content_type ) ; $ this -> content_type = $ content_type [ 0 ] ; if ( count ( $ content_type ) == 2 && strpos ( $ content_type [ 1 ] , '=' ) !== false ) { list ( $ nill , $ this -> charset ) = explode ( '=' , $ content_type [ 1 ] ) ; } // RFC 2616 states "text/*" Content-Types should have a default // charset of ISO-8859-1. "application/*" and other Content-Types // are assumed to have UTF-8 unless otherwise specified. // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1 // http://www.w3.org/International/O-HTTP-charset.en.php if ( ! isset ( $ this -> charset ) ) { $ this -> charset = substr ( $ this -> content_type , 5 ) === 'text/' ? 'iso-8859-1' : 'utf-8' ; } // Is vendor type? Is personal type? if ( strpos ( $ this -> content_type , '/' ) !== false ) { list ( $ type , $ sub_type ) = explode ( '/' , $ this -> content_type ) ; $ this -> is_mime_vendor_specific = substr ( $ sub_type , 0 , 4 ) === 'vnd.' ; $ this -> is_mime_personal = substr ( $ sub_type , 0 , 4 ) === 'prs.' ; } // Parent type (e.g. xml for application/vnd.github.message+xml) $ this -> parent_type = $ this -> content_type ; if ( strpos ( $ this -> content_type , '+' ) !== false ) { list ( $ vendor , $ this -> parent_type ) = explode ( '+' , $ this -> content_type , 2 ) ; $ this -> parent_type = Mime :: getFullMime ( $ this -> parent_type ) ; } }
After we've parse the headers, let's clean things
up a bit and treat some headers specially
After we ve parse the headers let s clean things up a bit and treat some headers specially