Changeset 49806
- Timestamp:
- 12/16/2020 02:24:07 PM (4 years ago)
- Location:
- branches/5.6
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
- Property svn:mergeinfo changed
/trunk merged: 49803,49805
- Property svn:mergeinfo changed
-
branches/5.6/src/wp-includes/class-wp-simplepie-file.php
r49120 r49806 11 11 * Core class for fetching remote files and reading local files with SimplePie. 12 12 * 13 * This uses Core's HTTP API to make requests, which gives plugins the ability 14 * to hook into the process. 15 * 13 16 * @since 2.8.0 14 17 * … … 22 25 * @since 2.8.0 23 26 * @since 3.2.0 Updated to use a PHP5 constructor. 27 * @since 5.6.1 Multiple headers are concatenated into a comma-separated string, rather than remaining 28 * an array. 24 29 * 25 30 * @param string $url Remote file URL. … … 61 66 $this->error = 'WP HTTP Error: ' . $res->get_error_message(); 62 67 $this->success = false; 68 63 69 } else { 64 $this->headers = wp_remote_retrieve_headers( $res ); 70 $this->headers = wp_remote_retrieve_headers( $res ); 71 72 /* 73 * SimplePie expects multiple headers to be stored as a comma-separated string, but 74 * `wp_remote_retrieve_headers()` returns them as an array, so they need to be 75 * converted. 76 * 77 * The only exception to that is the `content-type` header, which should ignore any 78 * previous values and only use the last one. 79 * 80 * @see SimplePie_HTTP_Parser::new_line(). 81 */ 82 foreach ( $this->headers as $name => $value ) { 83 if ( ! is_array( $value ) ) { 84 continue; 85 } 86 87 if ( 'content-type' === $name ) { 88 $this->headers[ $name ] = array_pop( $value ); 89 } else { 90 $this->headers[ $name ] = implode( ', ', $value ); 91 } 92 } 93 65 94 $this->body = wp_remote_retrieve_body( $res ); 66 95 $this->status_code = wp_remote_retrieve_response_code( $res );
Note: See TracChangeset
for help on using the changeset viewer.