# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
|
|
|
149 | 149 | $r['headers'] = array(); |
150 | 150 | |
151 | 151 | if ( ! is_array( $r['headers'] ) ) { |
152 | | $processedHeaders = WP_Http::processHeaders( $r['headers'] ); |
| 152 | $processedHeaders = WP_Http::process_headers( $r['headers'] ); |
153 | 153 | $r['headers'] = $processedHeaders['headers']; |
154 | 154 | } |
155 | 155 | |
… |
… |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // Construct Cookie: header if any cookies are set |
167 | | WP_Http::buildCookieHeader( $r ); |
| 167 | WP_Http::build_cookie_header( $r ); |
168 | 168 | |
169 | 169 | if ( WP_Http_Encoding::is_available() ) |
170 | 170 | $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding(); |
… |
… |
|
321 | 321 | * @param string $strResponse The full response string |
322 | 322 | * @return array Array with 'headers' and 'body' keys. |
323 | 323 | */ |
324 | | function processResponse($strResponse) { |
| 324 | function process_response($strResponse) { |
325 | 325 | $res = explode("\r\n\r\n", $strResponse, 2); |
326 | 326 | |
327 | 327 | return array('headers' => $res[0], 'body' => isset($res[1]) ? $res[1] : ''); |
… |
… |
|
341 | 341 | * @return array Processed string headers. If duplicate headers are encountered, |
342 | 342 | * Then a numbered array is returned as the value of that header-key. |
343 | 343 | */ |
344 | | public static function processHeaders($headers) { |
| 344 | public static function process_headers($headers) { |
345 | 345 | // split headers, one per array element |
346 | 346 | if ( is_string($headers) ) { |
347 | 347 | // tolerate line terminator: CRLF = LF (RFC 2616 19.3) |
… |
… |
|
408 | 408 | * |
409 | 409 | * @param array $r Full array of args passed into ::request() |
410 | 410 | */ |
411 | | public static function buildCookieHeader( &$r ) { |
| 411 | public static function build_cookie_header( &$r ) { |
412 | 412 | if ( ! empty($r['cookies']) ) { |
413 | 413 | $cookies_header = ''; |
414 | 414 | foreach ( (array) $r['cookies'] as $cookie ) { |
415 | | $cookies_header .= $cookie->getHeaderValue() . '; '; |
| 415 | $cookies_header .= $cookie->get_header_value() . '; '; |
416 | 416 | } |
417 | 417 | $cookies_header = substr( $cookies_header, 0, -2 ); |
418 | 418 | $r['headers']['cookie'] = $cookies_header; |
… |
… |
|
435 | 435 | * @param string $body Body content |
436 | 436 | * @return string Chunked decoded body on success or raw body on failure. |
437 | 437 | */ |
438 | | function chunkTransferDecode($body) { |
| 438 | function chunk_transfer_decode($body) { |
439 | 439 | $body = str_replace(array("\r\n", "\r"), "\n", $body); |
440 | 440 | // The body is not chunked encoding or is malformed. |
441 | 441 | if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) ) |
… |
… |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | // Construct Cookie: header if any cookies are set |
630 | | WP_Http::buildCookieHeader( $r ); |
| 630 | WP_Http::build_cookie_header( $r ); |
631 | 631 | |
632 | 632 | $iError = null; // Store error number |
633 | 633 | $strError = null; // Store error string |
… |
… |
|
748 | 748 | } else { |
749 | 749 | $strResponse .= $block; |
750 | 750 | if ( strpos( $strResponse, "\r\n\r\n" ) ) { |
751 | | $process = WP_Http::processResponse( $strResponse ); |
| 751 | $process = WP_Http::process_response( $strResponse ); |
752 | 752 | $bodyStarted = true; |
753 | 753 | fwrite( $stream_handle, $process['body'] ); |
754 | 754 | unset( $strResponse ); |
… |
… |
|
763 | 763 | while ( ! feof($handle) ) |
764 | 764 | $strResponse .= fread( $handle, 4096 ); |
765 | 765 | |
766 | | $process = WP_Http::processResponse( $strResponse ); |
| 766 | $process = WP_Http::process_response( $strResponse ); |
767 | 767 | unset( $strResponse ); |
768 | 768 | } |
769 | 769 | |
… |
… |
|
772 | 772 | if ( true === $secure_transport ) |
773 | 773 | error_reporting($error_reporting); |
774 | 774 | |
775 | | $arrHeaders = WP_Http::processHeaders( $process['headers'] ); |
| 775 | $arrHeaders = WP_Http::process_headers( $process['headers'] ); |
776 | 776 | |
777 | 777 | // If location is found, then assume redirect and redirect to location. |
778 | 778 | if ( isset($arrHeaders['headers']['location']) && 0 !== $r['_redirection'] ) { |
… |
… |
|
785 | 785 | |
786 | 786 | // If the body was chunk encoded, then decode it. |
787 | 787 | if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] ) |
788 | | $process['body'] = WP_Http::chunkTransferDecode($process['body']); |
| 788 | $process['body'] = WP_Http::chunk_transfer_decode($process['body']); |
789 | 789 | |
790 | 790 | if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) ) |
791 | 791 | $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); |
… |
… |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | // Construct Cookie: header if any cookies are set |
861 | | WP_Http::buildCookieHeader( $r ); |
| 861 | WP_Http::build_cookie_header( $r ); |
862 | 862 | |
863 | 863 | $arrURL = parse_url($url); |
864 | 864 | |
… |
… |
|
956 | 956 | |
957 | 957 | $processedHeaders = array(); |
958 | 958 | if ( isset( $meta['wrapper_data']['headers'] ) ) |
959 | | $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']); |
| 959 | $processedHeaders = WP_Http::process_headers($meta['wrapper_data']['headers']); |
960 | 960 | else |
961 | | $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']); |
| 961 | $processedHeaders = WP_Http::process_headers($meta['wrapper_data']); |
962 | 962 | |
963 | 963 | // Streams does not provide an error code which we can use to see why the request stream stopped. |
964 | 964 | // We can however test to see if a location header is present and return based on that. |
… |
… |
|
966 | 966 | return new WP_Error('http_request_failed', __('Too many redirects.')); |
967 | 967 | |
968 | 968 | if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] ) |
969 | | $strResponse = WP_Http::chunkTransferDecode($strResponse); |
| 969 | $strResponse = WP_Http::chunk_transfer_decode($strResponse); |
970 | 970 | |
971 | 971 | if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) ) |
972 | 972 | $strResponse = WP_Http_Encoding::decompress( $strResponse ); |
… |
… |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | // Construct Cookie: header if any cookies are set. |
1051 | | WP_Http::buildCookieHeader( $r ); |
| 1051 | WP_Http::build_cookie_header( $r ); |
1052 | 1052 | |
1053 | 1053 | $handle = curl_init(); |
1054 | 1054 | |
… |
… |
|
1151 | 1151 | |
1152 | 1152 | $theResponse = curl_exec( $handle ); |
1153 | 1153 | $theBody = ''; |
1154 | | $theHeaders = WP_Http::processHeaders( $this->headers ); |
| 1154 | $theHeaders = WP_Http::process_headers( $this->headers ); |
1155 | 1155 | |
1156 | 1156 | if ( strlen($theResponse) > 0 && ! is_bool( $theResponse ) ) // is_bool: when using $args['stream'], curl_exec will return (bool)true |
1157 | 1157 | $theBody = $theResponse; |
… |
… |
|
1587 | 1587 | * |
1588 | 1588 | * @return string Header encoded cookie name and value. |
1589 | 1589 | */ |
1590 | | function getHeaderValue() { |
| 1590 | function get_header_value() { |
1591 | 1591 | if ( ! isset( $this->name ) || ! isset( $this->value ) ) |
1592 | 1592 | return ''; |
1593 | 1593 | |
… |
… |
|
1602 | 1602 | * |
1603 | 1603 | * @return string |
1604 | 1604 | */ |
1605 | | function getFullHeader() { |
1606 | | return 'Cookie: ' . $this->getHeaderValue(); |
| 1605 | function get_full_header() { |
| 1606 | return 'Cookie: ' . $this->get_header_value(); |
1607 | 1607 | } |
1608 | 1608 | } |
1609 | 1609 | |