Changeset 52244 for trunk/src/wp-includes/Requests/Proxy/Http.php
- Timestamp:
- 11/25/2021 01:10:30 AM (5 years ago)
- File:
-
- 1 moved
-
trunk/src/wp-includes/Requests/Proxy/Http.php (moved) (moved from trunk/src/wp-includes/Requests/Proxy/HTTP.php ) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Requests/Proxy/Http.php
r52243 r52244 3 3 * HTTP Proxy connection interface 4 4 * 5 * @package Requests 6 * @subpackage Proxy 7 * @since 1.6 5 * @package Requests\Proxy 6 * @since 1.6 8 7 */ 8 9 namespace WpOrg\Requests\Proxy; 10 11 use WpOrg\Requests\Exception\ArgumentCount; 12 use WpOrg\Requests\Exception\InvalidArgument; 13 use WpOrg\Requests\Hooks; 14 use WpOrg\Requests\Proxy; 9 15 10 16 /** … … 13 19 * Provides a handler for connection via an HTTP proxy 14 20 * 15 * @package Requests 16 * @subpackage Proxy 17 * @since 1.6 21 * @package Requests\Proxy 22 * @since 1.6 18 23 */ 19 class Requests_Proxy_HTTP implements Requests_Proxy {24 final class Http implements Proxy { 20 25 /** 21 26 * Proxy host and port … … 52 57 * 53 58 * @since 1.6 54 * @throws Requests_Exception On incorrect number of arguments (`authbasicbadargs`) 55 * @param array|null $args Array of user and password. Must have exactly two elements 59 * 60 * @param array|string|null $args Proxy as a string or an array of proxy, user and password. 61 * When passed as an array, must have exactly one (proxy) 62 * or three elements (proxy, user, password). 63 * 64 * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array, a string or null. 65 * @throws \WpOrg\Requests\Exception\ArgumentCount On incorrect number of arguments (`proxyhttpbadargs`) 56 66 */ 57 67 public function __construct($args = null) { … … 68 78 } 69 79 else { 70 throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); 80 throw ArgumentCount::create( 81 'an array with exactly one element or exactly three elements', 82 count($args), 83 'proxyhttpbadargs' 84 ); 71 85 } 86 } elseif ($args !== null) { 87 throw InvalidArgument::create(1, '$args', 'array|string|null', gettype($args)); 72 88 } 73 89 } … … 77 93 * 78 94 * @since 1.6 79 * @see curl_before_send80 * @see fsockopen_remote_socket81 * @see fsockopen_remote_host_path82 * @see fsockopen_header83 * @param Requests_Hooks $hooks Hook system95 * @see \WpOrg\Requests\Proxy\HTTP::curl_before_send() 96 * @see \WpOrg\Requests\Proxy\HTTP::fsockopen_remote_socket() 97 * @see \WpOrg\Requests\Proxy\HTTP::fsockopen_remote_host_path() 98 * @see \WpOrg\Requests\Proxy\HTTP::fsockopen_header() 99 * @param \WpOrg\Requests\Hooks $hooks Hook system 84 100 */ 85 public function register( Requests_Hooks $hooks) {86 $hooks->register('curl.before_send', array($this, 'curl_before_send'));101 public function register(Hooks $hooks) { 102 $hooks->register('curl.before_send', [$this, 'curl_before_send']); 87 103 88 $hooks->register('fsockopen.remote_socket', array($this, 'fsockopen_remote_socket'));89 $hooks->register('fsockopen.remote_host_path', array($this, 'fsockopen_remote_host_path'));104 $hooks->register('fsockopen.remote_socket', [$this, 'fsockopen_remote_socket']); 105 $hooks->register('fsockopen.remote_host_path', [$this, 'fsockopen_remote_host_path']); 90 106 if ($this->use_authentication) { 91 $hooks->register('fsockopen.after_headers', array($this, 'fsockopen_header'));107 $hooks->register('fsockopen.after_headers', [$this, 'fsockopen_header']); 92 108 } 93 109 } … … 97 113 * 98 114 * @since 1.6 99 * @param resource $handle cURL resource115 * @param resource|\CurlHandle $handle cURL handle 100 116 */ 101 117 public function curl_before_send(&$handle) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)