Ticket #14184: 14184.diff
| File 14184.diff, 2.7 KB (added by jacobsantos, 3 years ago) |
|---|
-
class-http.php
434 434 $cookies = array(); 435 435 $newheaders = array(); 436 436 foreach ( $headers as $tempheader ) { 437 // Sanity check, this should never be true, but prevents no lines from processing. Also 438 // the rare event that there are lines in between the headers that are empty. 437 439 if ( empty($tempheader) ) 438 440 continue; 439 441 … … 443 445 } 444 446 445 447 list($key, $value) = explode(':', $tempheader, 2); 448 $value = trim( $value ); // Remove spaces before and after for the value. 446 449 447 if ( !empty( $value )) {450 if ( $value != "" ) { 448 451 $key = strtolower( $key ); 449 452 if ( isset( $newheaders[$key] ) ) { 450 453 if ( !is_array($newheaders[$key]) ) 451 454 $newheaders[$key] = array($newheaders[$key]); 452 $newheaders[$key][] = trim( $value );455 $newheaders[$key][] = $value; 453 456 } else { 454 $newheaders[$key] = trim( $value );457 $newheaders[$key] = $value; 455 458 } 456 459 if ( 'set-cookie' == $key ) 457 460 $cookies[] = new WP_Http_Cookie( $value ); … … 491 494 * Based off the HTTP http_encoding_dechunk function. Does not support UTF-8. Does not support 492 495 * returning footer headers. Shouldn't be too difficult to support it though. 493 496 * 497 * @link http://tools.ietf.org/html/rfc2616#section-19.4.6 Process for chunked decoding. 498 * 494 499 * @todo Add support for footer chunked headers. 495 500 * @access public 496 501 * @since 2.7.0 … … 512 517 $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match ); 513 518 514 519 if ( $hasChunk ) { 520 // http://tools.ietf.org/html/rfc2616#page-14 - Augmented BNF states what *rule 521 // Means and the chunked encoding http://tools.ietf.org/html/rfc2616#section-3.6.1 522 // defined says that only one HEX character is required. In many cases during 523 // testing, the last HEX digit will be '0' and will match. If not, then nothing 524 // will be adversely affected. 515 525 if ( empty( $match[1] ) ) 516 526 return $body; 517 527 … … 1735 1745 // Set everything else as a property 1736 1746 foreach ( $pairs as $pair ) { 1737 1747 $pair = rtrim($pair); 1738 if ( empty($pair)) //Handles the cookie ending in ; which results in a empty final pair1748 if ( $pair == "" ) //Handles the cookie ending in ; which results in a empty final pair 1739 1749 continue; 1740 1750 1741 1751 list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' ); … … 1814 1824 * @return string Header encoded cookie name and value. 1815 1825 */ 1816 1826 function getHeaderValue() { 1817 if ( empty( $this->name ) || empty( $this->value ))1827 if ( empty( $this->name ) || $this->value == '' ) 1818 1828 return ''; 1819 1829 1820 1830 return $this->name . '=' . urlencode( $this->value );
