Changeset 46468
- Timestamp:
- 10/12/2019 06:03:22 PM (5 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-http.php
r46424 r46468 823 823 824 824 /** 825 * Block requests through the proxy.825 * Determines whether an HTTP API request to the given URL should be blocked. 826 826 * 827 827 * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will 828 * prevent plugins from working and core functionality, if you don't include api.wordpress.org.829 * 830 * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true in your wp-config.php828 * prevent plugins from working and core functionality, if you don't include `api.wordpress.org`. 829 * 830 * You block external URL requests by defining `WP_HTTP_BLOCK_EXTERNAL` as true in your `wp-config.php` 831 831 * file and this will only allow localhost and your site to make requests. The constant 832 * WP_ACCESSIBLE_HOSTSwill allow additional hosts to go through for requests. The format of the833 * WP_ACCESSIBLE_HOSTSconstant is a comma separated list of hostnames to allow, wildcard domains834 * are supported, eg *.wordpress.org will allow for all subdomains of wordpress.orgto be contacted.832 * `WP_ACCESSIBLE_HOSTS` will allow additional hosts to go through for requests. The format of the 833 * `WP_ACCESSIBLE_HOSTS` constant is a comma separated list of hostnames to allow, wildcard domains 834 * are supported, eg `*.wordpress.org` will allow for all subdomains of `wordpress.org` to be contacted. 835 835 * 836 836 * @since 2.8.0 … … 860 860 if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) { 861 861 /** 862 * Filters whether to block local requests through the proxy. 862 * Filters whether to block local HTTP API requests. 863 * 864 * A local request is one to `localhost` or to the same host as the site itself. 863 865 * 864 866 * @since 2.8.0 865 867 * 866 * @param bool $block Whether to block local requests through proxy. 867 * Default false. 868 * @param bool $block Whether to block local requests. Default false. 868 869 */ 869 870 return apply_filters( 'block_local_requests', false ); … … 994 995 * @since 3.7.0 995 996 * 996 * @param string $url The URL which was requested. 997 * @param array $args The Arguments which were used to make the request. 998 * @param array $response The Response of the HTTP request. 999 * @return false|object False if no redirect is present, a WP_HTTP or WP_Error result otherwise. 997 * @param string $url The URL which was requested. 998 * @param array $args The arguments which were used to make the request. 999 * @param array $response The response of the HTTP request. 1000 * @return false|WP_Error|array False if no redirect is present, a WP_Error object if there's an error, or an HTTP 1001 * API response array if the redirect is successfully followed. 1000 1002 */ 1001 1003 public static function handle_redirects( $url, $args, $response ) { -
trunk/src/wp-includes/class-wp-http-requests-response.php
r46424 r46468 134 134 * @since 4.6.0 135 135 * 136 * @return mixedResponse data.136 * @return string Response data. 137 137 */ 138 138 public function get_data() { … … 145 145 * @since 4.6.0 146 146 * 147 * @param mixed$data Response data.147 * @param string $data Response data. 148 148 */ 149 149 public function set_data( $data ) { -
trunk/src/wp-includes/http.php
r46424 r46468 40 40 * @see WP_Http::request() For default arguments information. 41 41 * 42 * @param string $url SiteURL to retrieve.42 * @param string $url URL to retrieve. 43 43 * @param array $args Optional. Request arguments. Default empty array. 44 44 * @return WP_Error|array The response or WP_Error on failure. … … 61 61 * @see WP_Http::request() For default arguments information. 62 62 * 63 * @param string $url SiteURL to retrieve.63 * @param string $url URL to retrieve. 64 64 * @param array $args Optional. Request arguments. Default empty array. 65 65 * @return WP_Error|array The response or WP_Error on failure. … … 82 82 * @see WP_Http::request() For default arguments information. 83 83 * 84 * @param string $url SiteURL to retrieve.84 * @param string $url URL to retrieve. 85 85 * @param array $args Optional. Request arguments. Default empty array. 86 86 * @return WP_Error|array The response or WP_Error on failure. … … 103 103 * @see WP_Http::request() For default arguments information. 104 104 * 105 * @param string $url SiteURL to retrieve.106 * @param array $args Optional. Request arguments. Default empty array.105 * @param string $url URL to retrieve. 106 * @param array $args Optional. Request arguments. Default empty array. 107 107 * @return WP_Error|array The response or WP_Error on failure. 108 108 */ … … 114 114 115 115 /** 116 * Retrieve the raw response from the HTTP request. 117 * 118 * The array structure is a little complex: 119 * 120 * $res = array( 121 * 'headers' => array(), 122 * 'response' => array( 123 * 'code' => int, 124 * 'message' => string 125 * ) 126 * ); 127 * 128 * All of the headers in $res['headers'] are with the name as the key and the 129 * value as the value. So to get the User-Agent, you would do the following. 130 * 131 * $user_agent = $res['headers']['user-agent']; 132 * 133 * The body is the raw response content and can be retrieved from $res['body']. 134 * 135 * This function is called first to make the request and there are other API 136 * functions to abstract out the above convoluted setup. 137 * 138 * Request method defaults for helper functions: 116 * Performs an HTTP request and returns its response. 117 * 118 * There are other API functions available which abstract away the HTTP method: 119 * 139 120 * - Default 'GET' for wp_remote_get() 140 121 * - Default 'POST' for wp_remote_post() … … 143 124 * @since 2.7.0 144 125 * 145 * @see WP_Http::request() For additionalinformation on default arguments.146 * 147 * @param string $url SiteURL to retrieve.126 * @see WP_Http::request() For information on default arguments. 127 * 128 * @param string $url URL to retrieve. 148 129 * @param array $args Optional. Request arguments. Default empty array. 149 * @return WP_Error|array The response or WP_Error on failure. 130 * @return WP_Error|array { 131 * The response array or a WP_Error on failure. 132 * 133 * @type string[] $headers Array of response headers keyed by their name. 134 * @type string $body Response body. 135 * @type array $response { 136 * Data about the HTTP response. 137 * 138 * @type int|false $code HTTP response code. 139 * @type string|false $message HTTP response message. 140 * } 141 * @type WP_HTTP_Cookie[] $cookies Array of response cookies. 142 * @type WP_HTTP_Requests_Response|null $http_response Raw HTTP response object. 143 * } 150 144 */ 151 145 function wp_remote_request( $url, $args = array() ) { … … 162 156 * @see WP_Http::request() For default arguments information. 163 157 * 164 * @param string $url SiteURL to retrieve.158 * @param string $url URL to retrieve. 165 159 * @param array $args Optional. Request arguments. Default empty array. 166 160 * @return WP_Error|array The response or WP_Error on failure. … … 179 173 * @see WP_Http::request() For default arguments information. 180 174 * 181 * @param string $url SiteURL to retrieve.175 * @param string $url URL to retrieve. 182 176 * @param array $args Optional. Request arguments. Default empty array. 183 177 * @return WP_Error|array The response or WP_Error on failure. … … 196 190 * @see WP_Http::request() For default arguments information. 197 191 * 198 * @param string $url SiteURL to retrieve.192 * @param string $url URL to retrieve. 199 193 * @param array $args Optional. Request arguments. Default empty array. 200 194 * @return WP_Error|array The response or WP_Error on failure. … … 213 207 * @see \Requests_Utility_CaseInsensitiveDictionary 214 208 * 215 * @param array $response HTTP response.209 * @param array|WP_Error $response HTTP response. 216 210 * @return array|\Requests_Utility_CaseInsensitiveDictionary The headers of the response. Empty array if incorrect parameter given. 217 211 */ … … 229 223 * @since 2.7.0 230 224 * 231 * @param array $response232 * @param string $headerHeader name to retrieve value from.225 * @param array|WP_Error $response HTTP response. 226 * @param string $header Header name to retrieve value from. 233 227 * @return string The header value. Empty string on if incorrect parameter given, or if the header doesn't exist. 234 228 */ … … 252 246 * @since 2.7.0 253 247 * 254 * @param array $response HTTP response.248 * @param array|WP_Error $response HTTP response. 255 249 * @return int|string The response code as an integer. Empty string on incorrect parameter given. 256 250 */ … … 270 264 * @since 2.7.0 271 265 * 272 * @param array $response HTTP response.266 * @param array|WP_Error $response HTTP response. 273 267 * @return string The response message. Empty string on incorrect parameter given. 274 268 */ … … 286 280 * @since 2.7.0 287 281 * 288 * @param array $response HTTP response.282 * @param array|WP_Error $response HTTP response. 289 283 * @return string The body of the response. Empty string if no body or incorrect parameter given. 290 284 */ … … 302 296 * @since 4.4.0 303 297 * 304 * @param array $response HTTP response.305 * @return arrayAn array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.298 * @param array|WP_Error $response HTTP response. 299 * @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error. 306 300 */ 307 301 function wp_remote_retrieve_cookies( $response ) { … … 318 312 * @since 4.4.0 319 313 * 320 * @param array 321 * @param string $name The name of the cookie to retrieve.314 * @param array|WP_Error $response HTTP response. 315 * @param string $name The name of the cookie to retrieve. 322 316 * @return WP_Http_Cookie|string The `WP_Http_Cookie` object. Empty string if the cookie isn't present in the response. 323 317 */ … … 343 337 * @since 4.4.0 344 338 * 345 * @param array 346 * @param string $name The name of the cookie to retrieve.339 * @param array|WP_Error $response HTTP response. 340 * @param string $name The name of the cookie to retrieve. 347 341 * @return string The value of the cookie. Empty string if the cookie isn't present in the response. 348 342 */
Note: See TracChangeset
for help on using the changeset viewer.