author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
3 |
* Core HTTP Request API |
0 | 4 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
5 |
* Standardizes the HTTP requests for WordPress. Handles cookies, gzip encoding and decoding, chunk |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
6 |
* decoding, if HTTP 1.1 and various other difficult HTTP protocol implementations. |
0 | 7 |
* |
8 |
* @package WordPress |
|
9 |
* @subpackage HTTP |
|
10 |
*/ |
|
11 |
||
12 |
/** |
|
13 |
* Returns the initialized WP_Http Object |
|
14 |
* |
|
15 |
* @since 2.7.0 |
|
16 |
* @access private |
|
17 |
* |
|
18 |
* @return WP_Http HTTP Transport object. |
|
19 |
*/ |
|
20 |
function _wp_http_get_object() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
static $http = null; |
0 | 22 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
if ( is_null( $http ) ) { |
0 | 24 |
$http = new WP_Http(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
} |
0 | 26 |
return $http; |
27 |
} |
|
28 |
||
29 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
30 |
* Retrieves the raw response from a safe HTTP request. |
0 | 31 |
* |
32 |
* This function is ideal when the HTTP request is being made to an arbitrary |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
33 |
* URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
34 |
* to avoid Server Side Request Forgery attacks (SSRF). |
0 | 35 |
* |
36 |
* @since 3.6.0 |
|
37 |
* |
|
5 | 38 |
* @see wp_remote_request() For more information on the response array format. |
39 |
* @see WP_Http::request() For default arguments information. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
40 |
* @see wp_http_validate_url() For more information about how the URL is validated. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
41 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
42 |
* @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery |
5 | 43 |
* |
16 | 44 |
* @param string $url URL to retrieve. |
5 | 45 |
* @param array $args Optional. Request arguments. Default empty array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
46 |
* See WP_Http::request() for information on accepted arguments. |
16 | 47 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 48 |
*/ |
49 |
function wp_safe_remote_request( $url, $args = array() ) { |
|
50 |
$args['reject_unsafe_urls'] = true; |
|
9 | 51 |
$http = _wp_http_get_object(); |
0 | 52 |
return $http->request( $url, $args ); |
53 |
} |
|
54 |
||
55 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
56 |
* Retrieves the raw response from a safe HTTP request using the GET method. |
0 | 57 |
* |
58 |
* This function is ideal when the HTTP request is being made to an arbitrary |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
59 |
* URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
60 |
* to avoid Server Side Request Forgery attacks (SSRF). |
0 | 61 |
* |
62 |
* @since 3.6.0 |
|
63 |
* |
|
5 | 64 |
* @see wp_remote_request() For more information on the response array format. |
65 |
* @see WP_Http::request() For default arguments information. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
66 |
* @see wp_http_validate_url() For more information about how the URL is validated. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
67 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
68 |
* @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery |
5 | 69 |
* |
16 | 70 |
* @param string $url URL to retrieve. |
5 | 71 |
* @param array $args Optional. Request arguments. Default empty array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
72 |
* See WP_Http::request() for information on accepted arguments. |
16 | 73 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 74 |
*/ |
75 |
function wp_safe_remote_get( $url, $args = array() ) { |
|
76 |
$args['reject_unsafe_urls'] = true; |
|
9 | 77 |
$http = _wp_http_get_object(); |
0 | 78 |
return $http->get( $url, $args ); |
79 |
} |
|
80 |
||
81 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
82 |
* Retrieves the raw response from a safe HTTP request using the POST method. |
0 | 83 |
* |
84 |
* This function is ideal when the HTTP request is being made to an arbitrary |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
85 |
* URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
86 |
* to avoid Server Side Request Forgery attacks (SSRF). |
0 | 87 |
* |
88 |
* @since 3.6.0 |
|
89 |
* |
|
5 | 90 |
* @see wp_remote_request() For more information on the response array format. |
91 |
* @see WP_Http::request() For default arguments information. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
92 |
* @see wp_http_validate_url() For more information about how the URL is validated. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
93 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
94 |
* @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery |
5 | 95 |
* |
16 | 96 |
* @param string $url URL to retrieve. |
5 | 97 |
* @param array $args Optional. Request arguments. Default empty array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
98 |
* See WP_Http::request() for information on accepted arguments. |
16 | 99 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 100 |
*/ |
101 |
function wp_safe_remote_post( $url, $args = array() ) { |
|
102 |
$args['reject_unsafe_urls'] = true; |
|
9 | 103 |
$http = _wp_http_get_object(); |
0 | 104 |
return $http->post( $url, $args ); |
105 |
} |
|
106 |
||
107 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
108 |
* Retrieves the raw response from a safe HTTP request using the HEAD method. |
0 | 109 |
* |
110 |
* This function is ideal when the HTTP request is being made to an arbitrary |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
111 |
* URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
112 |
* to avoid Server Side Request Forgery attacks (SSRF). |
0 | 113 |
* |
114 |
* @since 3.6.0 |
|
115 |
* |
|
5 | 116 |
* @see wp_remote_request() For more information on the response array format. |
117 |
* @see WP_Http::request() For default arguments information. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
118 |
* @see wp_http_validate_url() For more information about how the URL is validated. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
119 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
120 |
* @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery |
5 | 121 |
* |
16 | 122 |
* @param string $url URL to retrieve. |
123 |
* @param array $args Optional. Request arguments. Default empty array. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
124 |
* See WP_Http::request() for information on accepted arguments. |
16 | 125 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 126 |
*/ |
127 |
function wp_safe_remote_head( $url, $args = array() ) { |
|
128 |
$args['reject_unsafe_urls'] = true; |
|
9 | 129 |
$http = _wp_http_get_object(); |
0 | 130 |
return $http->head( $url, $args ); |
131 |
} |
|
132 |
||
133 |
/** |
|
16 | 134 |
* Performs an HTTP request and returns its response. |
0 | 135 |
* |
16 | 136 |
* There are other API functions available which abstract away the HTTP method: |
0 | 137 |
* |
138 |
* - Default 'GET' for wp_remote_get() |
|
139 |
* - Default 'POST' for wp_remote_post() |
|
140 |
* - Default 'HEAD' for wp_remote_head() |
|
141 |
* |
|
142 |
* @since 2.7.0 |
|
143 |
* |
|
16 | 144 |
* @see WP_Http::request() For information on default arguments. |
145 |
* |
|
146 |
* @param string $url URL to retrieve. |
|
147 |
* @param array $args Optional. Request arguments. Default empty array. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
148 |
* See WP_Http::request() for information on accepted arguments. |
16 | 149 |
* @return array|WP_Error { |
150 |
* The response array or a WP_Error on failure. |
|
5 | 151 |
* |
16 | 152 |
* @type string[] $headers Array of response headers keyed by their name. |
153 |
* @type string $body Response body. |
|
154 |
* @type array $response { |
|
155 |
* Data about the HTTP response. |
|
156 |
* |
|
157 |
* @type int|false $code HTTP response code. |
|
158 |
* @type string|false $message HTTP response message. |
|
159 |
* } |
|
160 |
* @type WP_HTTP_Cookie[] $cookies Array of response cookies. |
|
161 |
* @type WP_HTTP_Requests_Response|null $http_response Raw HTTP response object. |
|
162 |
* } |
|
0 | 163 |
*/ |
9 | 164 |
function wp_remote_request( $url, $args = array() ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
165 |
$http = _wp_http_get_object(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
return $http->request( $url, $args ); |
0 | 167 |
} |
168 |
||
169 |
/** |
|
16 | 170 |
* Performs an HTTP request using the GET method and returns its response. |
0 | 171 |
* |
172 |
* @since 2.7.0 |
|
173 |
* |
|
5 | 174 |
* @see wp_remote_request() For more information on the response array format. |
175 |
* @see WP_Http::request() For default arguments information. |
|
176 |
* |
|
16 | 177 |
* @param string $url URL to retrieve. |
5 | 178 |
* @param array $args Optional. Request arguments. Default empty array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
179 |
* See WP_Http::request() for information on accepted arguments. |
16 | 180 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 181 |
*/ |
9 | 182 |
function wp_remote_get( $url, $args = array() ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
$http = _wp_http_get_object(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
return $http->get( $url, $args ); |
0 | 185 |
} |
186 |
||
187 |
/** |
|
16 | 188 |
* Performs an HTTP request using the POST method and returns its response. |
0 | 189 |
* |
190 |
* @since 2.7.0 |
|
191 |
* |
|
5 | 192 |
* @see wp_remote_request() For more information on the response array format. |
193 |
* @see WP_Http::request() For default arguments information. |
|
194 |
* |
|
16 | 195 |
* @param string $url URL to retrieve. |
5 | 196 |
* @param array $args Optional. Request arguments. Default empty array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
197 |
* See WP_Http::request() for information on accepted arguments. |
16 | 198 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 199 |
*/ |
9 | 200 |
function wp_remote_post( $url, $args = array() ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
$http = _wp_http_get_object(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
return $http->post( $url, $args ); |
0 | 203 |
} |
204 |
||
205 |
/** |
|
16 | 206 |
* Performs an HTTP request using the HEAD method and returns its response. |
0 | 207 |
* |
208 |
* @since 2.7.0 |
|
209 |
* |
|
5 | 210 |
* @see wp_remote_request() For more information on the response array format. |
211 |
* @see WP_Http::request() For default arguments information. |
|
212 |
* |
|
16 | 213 |
* @param string $url URL to retrieve. |
5 | 214 |
* @param array $args Optional. Request arguments. Default empty array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
215 |
* See WP_Http::request() for information on accepted arguments. |
16 | 216 |
* @return array|WP_Error The response or WP_Error on failure. |
0 | 217 |
*/ |
9 | 218 |
function wp_remote_head( $url, $args = array() ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
219 |
$http = _wp_http_get_object(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
220 |
return $http->head( $url, $args ); |
0 | 221 |
} |
222 |
||
223 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
224 |
* Retrieves only the headers from the raw response. |
0 | 225 |
* |
226 |
* @since 2.7.0 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
227 |
* @since 4.6.0 Return value changed from an array to an WpOrg\Requests\Utility\CaseInsensitiveDictionary instance. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
* |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
229 |
* @see \WpOrg\Requests\Utility\CaseInsensitiveDictionary |
0 | 230 |
* |
16 | 231 |
* @param array|WP_Error $response HTTP response. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
232 |
* @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array The headers of the response, or empty array |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
233 |
* if incorrect parameter given. |
0 | 234 |
*/ |
5 | 235 |
function wp_remote_retrieve_headers( $response ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
236 |
if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { |
0 | 237 |
return array(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
238 |
} |
0 | 239 |
|
240 |
return $response['headers']; |
|
241 |
} |
|
242 |
||
243 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
244 |
* Retrieves a single header by name from the raw response. |
0 | 245 |
* |
246 |
* @since 2.7.0 |
|
247 |
* |
|
16 | 248 |
* @param array|WP_Error $response HTTP response. |
249 |
* @param string $header Header name to retrieve value from. |
|
19 | 250 |
* @return array|string The header(s) value(s). Array if multiple headers with the same name are retrieved. |
251 |
* Empty string if incorrect parameter given, or if the header doesn't exist. |
|
0 | 252 |
*/ |
5 | 253 |
function wp_remote_retrieve_header( $response, $header ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
254 |
if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) { |
0 | 255 |
return ''; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
256 |
} |
0 | 257 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
258 |
if ( isset( $response['headers'][ $header ] ) ) { |
9 | 259 |
return $response['headers'][ $header ]; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
260 |
} |
0 | 261 |
|
262 |
return ''; |
|
263 |
} |
|
264 |
||
265 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
266 |
* Retrieves only the response code from the raw response. |
0 | 267 |
* |
19 | 268 |
* Will return an empty string if incorrect parameter value is given. |
0 | 269 |
* |
270 |
* @since 2.7.0 |
|
271 |
* |
|
16 | 272 |
* @param array|WP_Error $response HTTP response. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
273 |
* @return int|string The response code as an integer. Empty string if incorrect parameter given. |
0 | 274 |
*/ |
5 | 275 |
function wp_remote_retrieve_response_code( $response ) { |
9 | 276 |
if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { |
0 | 277 |
return ''; |
9 | 278 |
} |
0 | 279 |
|
280 |
return $response['response']['code']; |
|
281 |
} |
|
282 |
||
283 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
284 |
* Retrieves only the response message from the raw response. |
0 | 285 |
* |
19 | 286 |
* Will return an empty string if incorrect parameter value is given. |
0 | 287 |
* |
288 |
* @since 2.7.0 |
|
289 |
* |
|
16 | 290 |
* @param array|WP_Error $response HTTP response. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
291 |
* @return string The response message. Empty string if incorrect parameter given. |
0 | 292 |
*/ |
5 | 293 |
function wp_remote_retrieve_response_message( $response ) { |
9 | 294 |
if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) { |
0 | 295 |
return ''; |
9 | 296 |
} |
0 | 297 |
|
298 |
return $response['response']['message']; |
|
299 |
} |
|
300 |
||
301 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
302 |
* Retrieves only the body from the raw response. |
0 | 303 |
* |
304 |
* @since 2.7.0 |
|
305 |
* |
|
16 | 306 |
* @param array|WP_Error $response HTTP response. |
0 | 307 |
* @return string The body of the response. Empty string if no body or incorrect parameter given. |
308 |
*/ |
|
5 | 309 |
function wp_remote_retrieve_body( $response ) { |
9 | 310 |
if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) { |
0 | 311 |
return ''; |
9 | 312 |
} |
0 | 313 |
|
314 |
return $response['body']; |
|
315 |
} |
|
316 |
||
317 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
318 |
* Retrieves only the cookies from the raw response. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
319 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
320 |
* @since 4.4.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
* |
16 | 322 |
* @param array|WP_Error $response HTTP response. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
323 |
* @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
324 |
* Empty array if there are none, or the response is a WP_Error. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
325 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
function wp_remote_retrieve_cookies( $response ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
327 |
if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
328 |
return array(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
329 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
330 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
331 |
return $response['cookies']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
332 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
333 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
334 |
/** |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
335 |
* Retrieves a single cookie by name from the raw response. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
336 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
337 |
* @since 4.4.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
* |
16 | 339 |
* @param array|WP_Error $response HTTP response. |
340 |
* @param string $name The name of the cookie to retrieve. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
341 |
* @return WP_Http_Cookie|string The `WP_Http_Cookie` object, or empty string |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
342 |
* if the cookie is not present in the response. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
343 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
344 |
function wp_remote_retrieve_cookie( $response, $name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
345 |
$cookies = wp_remote_retrieve_cookies( $response ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
346 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
347 |
if ( empty( $cookies ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
348 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
349 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
351 |
foreach ( $cookies as $cookie ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
352 |
if ( $cookie->name === $name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
353 |
return $cookie; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
354 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
355 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
356 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
357 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
358 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
359 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
360 |
/** |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
361 |
* Retrieves a single cookie's value by name from the raw response. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
362 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
363 |
* @since 4.4.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
364 |
* |
16 | 365 |
* @param array|WP_Error $response HTTP response. |
366 |
* @param string $name The name of the cookie to retrieve. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
367 |
* @return string The value of the cookie, or empty string |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
368 |
* if the cookie is not present in the response. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
369 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
370 |
function wp_remote_retrieve_cookie_value( $response, $name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
371 |
$cookie = wp_remote_retrieve_cookie( $response, $name ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
372 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
373 |
if ( ! ( $cookie instanceof WP_Http_Cookie ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
374 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
375 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
376 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
377 |
return $cookie->value; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
378 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
379 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
380 |
/** |
0 | 381 |
* Determines if there is an HTTP Transport that can process this request. |
382 |
* |
|
383 |
* @since 3.2.0 |
|
384 |
* |
|
385 |
* @param array $capabilities Array of capabilities to test or a wp_remote_request() $args array. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
386 |
* @param string $url Optional. If given, will check if the URL requires SSL and adds |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
387 |
* that requirement to the capabilities array. |
0 | 388 |
* |
389 |
* @return bool |
|
390 |
*/ |
|
391 |
function wp_http_supports( $capabilities = array(), $url = null ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
392 |
$http = _wp_http_get_object(); |
0 | 393 |
|
394 |
$capabilities = wp_parse_args( $capabilities ); |
|
395 |
||
396 |
$count = count( $capabilities ); |
|
397 |
||
16 | 398 |
// If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
399 |
if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) === $count ) { |
0 | 400 |
$capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) ); |
401 |
} |
|
402 |
||
9 | 403 |
if ( $url && ! isset( $capabilities['ssl'] ) ) { |
0 | 404 |
$scheme = parse_url( $url, PHP_URL_SCHEME ); |
16 | 405 |
if ( 'https' === $scheme || 'ssl' === $scheme ) { |
0 | 406 |
$capabilities['ssl'] = true; |
407 |
} |
|
408 |
} |
|
409 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
410 |
return (bool) $http->_get_first_available_transport( $capabilities ); |
0 | 411 |
} |
412 |
||
413 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
414 |
* Gets the HTTP Origin of the current request. |
0 | 415 |
* |
416 |
* @since 3.4.0 |
|
417 |
* |
|
418 |
* @return string URL of the origin. Empty string if no origin. |
|
419 |
*/ |
|
420 |
function get_http_origin() { |
|
421 |
$origin = ''; |
|
9 | 422 |
if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) { |
423 |
$origin = $_SERVER['HTTP_ORIGIN']; |
|
424 |
} |
|
0 | 425 |
|
426 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
427 |
* Changes the origin of an HTTP request. |
0 | 428 |
* |
429 |
* @since 3.4.0 |
|
430 |
* |
|
431 |
* @param string $origin The original origin for the request. |
|
432 |
*/ |
|
433 |
return apply_filters( 'http_origin', $origin ); |
|
434 |
} |
|
435 |
||
436 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
437 |
* Retrieves list of allowed HTTP origins. |
0 | 438 |
* |
439 |
* @since 3.4.0 |
|
440 |
* |
|
16 | 441 |
* @return string[] Array of origin URLs. |
0 | 442 |
*/ |
443 |
function get_allowed_http_origins() { |
|
444 |
$admin_origin = parse_url( admin_url() ); |
|
9 | 445 |
$home_origin = parse_url( home_url() ); |
0 | 446 |
|
16 | 447 |
// @todo Preserve port? |
9 | 448 |
$allowed_origins = array_unique( |
449 |
array( |
|
450 |
'http://' . $admin_origin['host'], |
|
451 |
'https://' . $admin_origin['host'], |
|
452 |
'http://' . $home_origin['host'], |
|
453 |
'https://' . $home_origin['host'], |
|
454 |
) |
|
455 |
); |
|
0 | 456 |
|
457 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
458 |
* Changes the origin types allowed for HTTP requests. |
0 | 459 |
* |
460 |
* @since 3.4.0 |
|
461 |
* |
|
16 | 462 |
* @param string[] $allowed_origins { |
463 |
* Array of default allowed HTTP origins. |
|
464 |
* |
|
465 |
* @type string $0 Non-secure URL for admin origin. |
|
466 |
* @type string $1 Secure URL for admin origin. |
|
467 |
* @type string $2 Non-secure URL for home origin. |
|
468 |
* @type string $3 Secure URL for home origin. |
|
0 | 469 |
* } |
470 |
*/ |
|
9 | 471 |
return apply_filters( 'allowed_http_origins', $allowed_origins ); |
0 | 472 |
} |
473 |
||
474 |
/** |
|
475 |
* Determines if the HTTP origin is an authorized one. |
|
476 |
* |
|
477 |
* @since 3.4.0 |
|
478 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
479 |
* @param string|null $origin Origin URL. If not provided, the value of get_http_origin() is used. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
480 |
* @return string Origin URL if allowed, empty string if not. |
0 | 481 |
*/ |
482 |
function is_allowed_http_origin( $origin = null ) { |
|
483 |
$origin_arg = $origin; |
|
484 |
||
9 | 485 |
if ( null === $origin ) { |
0 | 486 |
$origin = get_http_origin(); |
9 | 487 |
} |
0 | 488 |
|
16 | 489 |
if ( $origin && ! in_array( $origin, get_allowed_http_origins(), true ) ) { |
0 | 490 |
$origin = ''; |
9 | 491 |
} |
0 | 492 |
|
493 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
494 |
* Changes the allowed HTTP origin result. |
0 | 495 |
* |
496 |
* @since 3.4.0 |
|
497 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
498 |
* @param string $origin Origin URL if allowed, empty string if not. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
499 |
* @param string $origin_arg Original origin string passed into is_allowed_http_origin function. |
0 | 500 |
*/ |
501 |
return apply_filters( 'allowed_http_origin', $origin, $origin_arg ); |
|
502 |
} |
|
503 |
||
504 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
505 |
* Sends Access-Control-Allow-Origin and related headers if the current request |
0 | 506 |
* is from an allowed origin. |
507 |
* |
|
508 |
* If the request is an OPTIONS request, the script exits with either access |
|
509 |
* control headers sent, or a 403 response if the origin is not allowed. For |
|
510 |
* other request methods, you will receive a return value. |
|
511 |
* |
|
512 |
* @since 3.4.0 |
|
513 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
514 |
* @return string|false Returns the origin URL if headers are sent. Returns false |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
515 |
* if headers are not sent. |
0 | 516 |
*/ |
517 |
function send_origin_headers() { |
|
518 |
$origin = get_http_origin(); |
|
519 |
||
520 |
if ( is_allowed_http_origin( $origin ) ) { |
|
16 | 521 |
header( 'Access-Control-Allow-Origin: ' . $origin ); |
522 |
header( 'Access-Control-Allow-Credentials: true' ); |
|
9 | 523 |
if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) { |
0 | 524 |
exit; |
9 | 525 |
} |
0 | 526 |
return $origin; |
527 |
} |
|
528 |
||
529 |
if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) { |
|
530 |
status_header( 403 ); |
|
531 |
exit; |
|
532 |
} |
|
533 |
||
534 |
return false; |
|
535 |
} |
|
536 |
||
537 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
538 |
* Validates a URL for safe use in the HTTP API. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
539 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
540 |
* Examples of URLs that are considered unsafe: |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
541 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
542 |
* - ftp://example.com/caniload.php - Invalid protocol - only http and https are allowed. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
543 |
* - http:///example.com/caniload.php - Malformed URL. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
544 |
* - http://user:pass@example.com/caniload.php - Login information. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
545 |
* - http://exampleeeee.com/caniload.php - Invalid hostname, as the IP cannot be looked up in DNS. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
546 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
547 |
* Examples of URLs that are considered unsafe by default: |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
548 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
549 |
* - http://192.168.0.1/caniload.php - IPs from LAN networks. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
550 |
* This can be changed with the {@see 'http_request_host_is_external'} filter. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
551 |
* - http://198.143.164.252:81/caniload.php - By default, only 80, 443, and 8080 ports are allowed. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
552 |
* This can be changed with the {@see 'http_allowed_safe_ports'} filter. |
0 | 553 |
* |
554 |
* @since 3.5.2 |
|
555 |
* |
|
16 | 556 |
* @param string $url Request URL. |
557 |
* @return string|false URL or false on failure. |
|
0 | 558 |
*/ |
559 |
function wp_http_validate_url( $url ) { |
|
19 | 560 |
if ( ! is_string( $url ) || '' === $url || is_numeric( $url ) ) { |
561 |
return false; |
|
562 |
} |
|
563 |
||
5 | 564 |
$original_url = $url; |
9 | 565 |
$url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) ); |
566 |
if ( ! $url || strtolower( $url ) !== strtolower( $original_url ) ) { |
|
0 | 567 |
return false; |
9 | 568 |
} |
0 | 569 |
|
16 | 570 |
$parsed_url = parse_url( $url ); |
9 | 571 |
if ( ! $parsed_url || empty( $parsed_url['host'] ) ) { |
0 | 572 |
return false; |
9 | 573 |
} |
0 | 574 |
|
9 | 575 |
if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) ) { |
0 | 576 |
return false; |
9 | 577 |
} |
0 | 578 |
|
9 | 579 |
if ( false !== strpbrk( $parsed_url['host'], ':#?[]' ) ) { |
0 | 580 |
return false; |
9 | 581 |
} |
0 | 582 |
|
16 | 583 |
$parsed_home = parse_url( get_option( 'home' ) ); |
19 | 584 |
$same_host = isset( $parsed_home['host'] ) && strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); |
585 |
$host = trim( $parsed_url['host'], '.' ); |
|
0 | 586 |
|
587 |
if ( ! $same_host ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
588 |
if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) { |
0 | 589 |
$ip = $host; |
590 |
} else { |
|
591 |
$ip = gethostbyname( $host ); |
|
16 | 592 |
if ( $ip === $host ) { // Error condition for gethostbyname(). |
13 | 593 |
return false; |
9 | 594 |
} |
0 | 595 |
} |
596 |
if ( $ip ) { |
|
597 |
$parts = array_map( 'intval', explode( '.', $ip ) ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
598 |
if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0] |
0 | 599 |
|| ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) |
600 |
|| ( 192 === $parts[0] && 168 === $parts[1] ) |
|
601 |
) { |
|
602 |
// If host appears local, reject unless specifically allowed. |
|
603 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
604 |
* Checks if HTTP request is external or not. |
0 | 605 |
* |
606 |
* Allows to change and allow external requests for the HTTP request. |
|
607 |
* |
|
608 |
* @since 3.6.0 |
|
609 |
* |
|
16 | 610 |
* @param bool $external Whether HTTP request is external or not. |
611 |
* @param string $host Host name of the requested URL. |
|
612 |
* @param string $url Requested URL. |
|
0 | 613 |
*/ |
9 | 614 |
if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) ) { |
0 | 615 |
return false; |
9 | 616 |
} |
0 | 617 |
} |
618 |
} |
|
619 |
} |
|
620 |
||
9 | 621 |
if ( empty( $parsed_url['port'] ) ) { |
0 | 622 |
return $url; |
9 | 623 |
} |
0 | 624 |
|
625 |
$port = $parsed_url['port']; |
|
19 | 626 |
|
627 |
/** |
|
628 |
* Controls the list of ports considered safe in HTTP API. |
|
629 |
* |
|
630 |
* Allows to change and allow external requests for the HTTP request. |
|
631 |
* |
|
632 |
* @since 5.9.0 |
|
633 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
634 |
* @param int[] $allowed_ports Array of integers for valid ports. |
19 | 635 |
* @param string $host Host name of the requested URL. |
636 |
* @param string $url Requested URL. |
|
637 |
*/ |
|
638 |
$allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url ); |
|
639 |
if ( is_array( $allowed_ports ) && in_array( $port, $allowed_ports, true ) ) { |
|
0 | 640 |
return $url; |
9 | 641 |
} |
0 | 642 |
|
9 | 643 |
if ( $parsed_home && $same_host && isset( $parsed_home['port'] ) && $parsed_home['port'] === $port ) { |
0 | 644 |
return $url; |
9 | 645 |
} |
0 | 646 |
|
647 |
return false; |
|
648 |
} |
|
649 |
||
650 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
651 |
* Marks allowed redirect hosts safe for HTTP requests as well. |
0 | 652 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
653 |
* Attached to the {@see 'http_request_host_is_external'} filter. |
0 | 654 |
* |
655 |
* @since 3.6.0 |
|
656 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
657 |
* @param bool $is_external |
0 | 658 |
* @param string $host |
659 |
* @return bool |
|
660 |
*/ |
|
661 |
function allowed_http_request_hosts( $is_external, $host ) { |
|
9 | 662 |
if ( ! $is_external && wp_validate_redirect( 'http://' . $host ) ) { |
0 | 663 |
$is_external = true; |
9 | 664 |
} |
0 | 665 |
return $is_external; |
666 |
} |
|
667 |
||
668 |
/** |
|
16 | 669 |
* Adds any domain in a multisite installation for safe HTTP requests to the |
670 |
* allowed list. |
|
0 | 671 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
672 |
* Attached to the {@see 'http_request_host_is_external'} filter. |
0 | 673 |
* |
674 |
* @since 3.6.0 |
|
675 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
676 |
* @global wpdb $wpdb WordPress database abstraction object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
677 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
678 |
* @param bool $is_external |
0 | 679 |
* @param string $host |
680 |
* @return bool |
|
681 |
*/ |
|
682 |
function ms_allowed_http_request_hosts( $is_external, $host ) { |
|
5 | 683 |
global $wpdb; |
0 | 684 |
static $queried = array(); |
9 | 685 |
if ( $is_external ) { |
0 | 686 |
return $is_external; |
9 | 687 |
} |
16 | 688 |
if ( get_network()->domain === $host ) { |
0 | 689 |
return true; |
9 | 690 |
} |
691 |
if ( isset( $queried[ $host ] ) ) { |
|
0 | 692 |
return $queried[ $host ]; |
9 | 693 |
} |
0 | 694 |
$queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ); |
695 |
return $queried[ $host ]; |
|
696 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
697 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
698 |
/** |
19 | 699 |
* A wrapper for PHP's parse_url() function that handles consistency in the return values |
700 |
* across PHP versions. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
701 |
* |
19 | 702 |
* PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute URLs, including |
703 |
* schemeless and relative URLs with "://" in the path. This function works around |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
704 |
* those limitations providing a standard output on PHP 5.2~5.4+. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
705 |
* |
19 | 706 |
* Secondly, across various PHP versions, schemeless URLs containing a ":" in the query |
707 |
* are being handled inconsistently. This function works around those differences as well. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
708 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
709 |
* @since 4.4.0 |
9 | 710 |
* @since 4.7.0 The `$component` parameter was added for parity with PHP's `parse_url()`. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
711 |
* |
16 | 712 |
* @link https://www.php.net/manual/en/function.parse-url.php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
713 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
714 |
* @param string $url The URL to parse. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
715 |
* @param int $component The specific component to retrieve. Use one of the PHP |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
716 |
* predefined constants to specify which one. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
717 |
* Defaults to -1 (= return all parts as an array). |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
718 |
* @return mixed False on parse failure; Array of URL components on success; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
719 |
* When a specific component has been requested: null if the component |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
720 |
* doesn't exist in the given URL; a string or - in the case of |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
721 |
* PHP_URL_PORT - integer when it does. See parse_url()'s return values. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
722 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
723 |
function wp_parse_url( $url, $component = -1 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
724 |
$to_unset = array(); |
18 | 725 |
$url = (string) $url; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
726 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
727 |
if ( str_starts_with( $url, '//' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
728 |
$to_unset[] = 'scheme'; |
9 | 729 |
$url = 'placeholder:' . $url; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
730 |
} elseif ( str_starts_with( $url, '/' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
731 |
$to_unset[] = 'scheme'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
732 |
$to_unset[] = 'host'; |
9 | 733 |
$url = 'placeholder://placeholder' . $url; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
734 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
735 |
|
16 | 736 |
$parts = parse_url( $url ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
737 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
738 |
if ( false === $parts ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
739 |
// Parsing failure. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
740 |
return $parts; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
741 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
742 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
743 |
// Remove the placeholder values. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
744 |
foreach ( $to_unset as $key ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
745 |
unset( $parts[ $key ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
746 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
747 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
748 |
return _get_component_from_parsed_url_array( $parts, $component ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
749 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
750 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
751 |
/** |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
752 |
* Retrieves a specific component from a parsed URL array. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
753 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
754 |
* @internal |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
755 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
756 |
* @since 4.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
757 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
758 |
* |
16 | 759 |
* @link https://www.php.net/manual/en/function.parse-url.php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
760 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
761 |
* @param array|false $url_parts The parsed URL. Can be false if the URL failed to parse. |
16 | 762 |
* @param int $component The specific component to retrieve. Use one of the PHP |
763 |
* predefined constants to specify which one. |
|
764 |
* Defaults to -1 (= return all parts as an array). |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
765 |
* @return mixed False on parse failure; Array of URL components on success; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
766 |
* When a specific component has been requested: null if the component |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
767 |
* doesn't exist in the given URL; a string or - in the case of |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
768 |
* PHP_URL_PORT - integer when it does. See parse_url()'s return values. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
769 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
770 |
function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
771 |
if ( -1 === $component ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
772 |
return $url_parts; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
773 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
774 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
775 |
$key = _wp_translate_php_url_constant_to_key( $component ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
776 |
if ( false !== $key && is_array( $url_parts ) && isset( $url_parts[ $key ] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
777 |
return $url_parts[ $key ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
778 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
779 |
return null; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
780 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
781 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
782 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
783 |
/** |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
784 |
* Translates a PHP_URL_* constant to the named array keys PHP uses. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
785 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
786 |
* @internal |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
787 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
788 |
* @since 4.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
789 |
* @access private |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
790 |
* |
16 | 791 |
* @link https://www.php.net/manual/en/url.constants.php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
792 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
793 |
* @param int $constant PHP_URL_* constant. |
16 | 794 |
* @return string|false The named key or false. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
795 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
796 |
function _wp_translate_php_url_constant_to_key( $constant ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
797 |
$translation = array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
798 |
PHP_URL_SCHEME => 'scheme', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
799 |
PHP_URL_HOST => 'host', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
800 |
PHP_URL_PORT => 'port', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
801 |
PHP_URL_USER => 'user', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
802 |
PHP_URL_PASS => 'pass', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
803 |
PHP_URL_PATH => 'path', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
804 |
PHP_URL_QUERY => 'query', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
805 |
PHP_URL_FRAGMENT => 'fragment', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
806 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
807 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
808 |
if ( isset( $translation[ $constant ] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
809 |
return $translation[ $constant ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
810 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
811 |
return false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
812 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
813 |
} |