968.patch

Relevant changes in 968 - Ryan Parman, 2008-03-30 07:23

Download (1.6 KB)

 
simplepie.inc (revision 968)
7754 7754
							}
7755 7755
							if (isset($this->headers['content-encoding']) && ($this->headers['content-encoding'] === 'gzip' || $this->headers['content-encoding'] === 'deflate'))
7756 7756
							{
7757
								if (substr($this->body, 0, 8) === "\x1f\x8b\x08\x00\x00\x00\x00\x00")
7757
								// if (substr($this->body, 0, 8) === "\x1f\x8b\x08\x00\x00\x00\x00\x00")
7758
								// {
7759
								// 	$this->body = substr($this->body, 10);
7760
								// }
7761
								// $this->body = gzinflate($this->body);
7762

  
7763
								/**
7764
								 * Improved gzip decoding.
7765
								 * Author: patatraboum at free dot fr <http://us.php.net/manual/en/function.gzinflate.php#77336>
7766
								 */
7767
								if (substr($this->body, 0, 3) === "\x1f\x8b\x08")
7758 7768
								{
7759
									$this->body = substr($this->body, 10);
7769
									$i = 10;
7770
									$flg = ord(substr($this->body, 3, 1));
7771
								
7772
									if ($flg > 0)
7773
									{
7774
										if ($flg & 4)
7775
										{
7776
											list($xlen) = unpack('v', substr($this->body, $i, 2));
7777
											$i = $i + 2 + $xlen;
7778
										}
7779
										if ($flg & 8)
7780
										{
7781
											$i = strpos($this->body, "\0", $i) +1;
7782
										}
7783
										if ($flg & 16)
7784
										{
7785
											$i = strpos($this->body, "\0", $i) +1;
7786
										}
7787
										if ($flg & 2)
7788
										{
7789
											$i = $i + 2;
7790
										}
7791
									}
7792
								
7793
									$this->body = gzinflate(substr($this->body, $i, -8));
7760 7794
								}
7761
								$this->body = gzinflate($this->body);
7795

  
7796

  
7762 7797
							}
7763 7798
						}
7764 7799
					}