wp/wp-includes/SimplePie/HTTP/Parser.php
changeset 16 a86126ab1dd4
parent 0 d970ebf37754
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     3  * SimplePie
     3  * SimplePie
     4  *
     4  *
     5  * A PHP-Based RSS and Atom Feed Framework.
     5  * A PHP-Based RSS and Atom Feed Framework.
     6  * Takes the hard work out of managing a complete RSS/Atom solution.
     6  * Takes the hard work out of managing a complete RSS/Atom solution.
     7  *
     7  *
     8  * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
     8  * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
     9  * All rights reserved.
     9  * All rights reserved.
    10  *
    10  *
    11  * Redistribution and use in source and binary forms, with or without modification, are
    11  * Redistribution and use in source and binary forms, with or without modification, are
    12  * permitted provided that the following conditions are met:
    12  * permitted provided that the following conditions are met:
    13  *
    13  *
    31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    32  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    32  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    33  * POSSIBILITY OF SUCH DAMAGE.
    33  * POSSIBILITY OF SUCH DAMAGE.
    34  *
    34  *
    35  * @package SimplePie
    35  * @package SimplePie
    36  * @version 1.3.1
    36  * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
    37  * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
       
    38  * @author Ryan Parman
    37  * @author Ryan Parman
    39  * @author Geoffrey Sneddon
    38  * @author Sam Sneddon
    40  * @author Ryan McCue
    39  * @author Ryan McCue
    41  * @link http://simplepie.org/ SimplePie
    40  * @link http://simplepie.org/ SimplePie
    42  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
    41  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
    43  */
    42  */
    44 
    43 
   154 		$this->data = '';
   153 		$this->data = '';
   155 		if ($this->state === 'emit' || $this->state === 'body')
   154 		if ($this->state === 'emit' || $this->state === 'body')
   156 		{
   155 		{
   157 			return true;
   156 			return true;
   158 		}
   157 		}
   159 		else
   158 
   160 		{
   159 		$this->http_version = '';
   161 			$this->http_version = '';
   160 		$this->status_code = '';
   162 			$this->status_code = '';
   161 		$this->reason = '';
   163 			$this->reason = '';
   162 		$this->headers = array();
   164 			$this->headers = array();
   163 		$this->body = '';
   165 			$this->body = '';
   164 		return false;
   166 			return false;
       
   167 		}
       
   168 	}
   165 	}
   169 
   166 
   170 	/**
   167 	/**
   171 	 * Check whether there is data beyond the pointer
   168 	 * Check whether there is data beyond the pointer
   172 	 *
   169 	 *
   495 				$this->body = $decoded;
   492 				$this->body = $decoded;
   496 				return;
   493 				return;
   497 			}
   494 			}
   498 		}
   495 		}
   499 	}
   496 	}
       
   497 
       
   498 	/**
       
   499 	 * Prepare headers (take care of proxies headers)
       
   500 	 *
       
   501 	 * @param string  $headers Raw headers
       
   502 	 * @param integer $count   Redirection count. Default to 1.
       
   503 	 *
       
   504 	 * @return string
       
   505 	 */
       
   506 	static public function prepareHeaders($headers, $count = 1)
       
   507 	{
       
   508 		$data = explode("\r\n\r\n", $headers, $count);
       
   509 		$data = array_pop($data);
       
   510 		if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n\r\n")) {
       
   511 			$data = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $data);
       
   512 		}
       
   513 		if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n\r\n")) {
       
   514 			$data = str_ireplace("HTTP/1.1 200 Connection established\r\n\r\n", '', $data);
       
   515 		}
       
   516 		return $data;
       
   517 	}
   500 }
   518 }