← All changes
|
vendor_prefixed/guzzlehttp/guzzle/src/Handler/ProxyEnvironment.php
+8
-3
28.1
→
trunk
View file →
| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace YoastSEO_Vendor\GuzzleHttp\Handler; |
| 4 | 4 | |
| 5 | +use YoastSEO_Vendor\GuzzleHttp\Psr7; | |
| 5 | 6 | /** |
| 6 | 7 | * Resolves proxy configuration from the process environment with the same |
| 7 | 8 | * semantics libcurl applies, so the cURL handlers can pin CURLOPT_PROXY and |
| 8 | 9 | * CURLOPT_NOPROXY explicitly and libcurl never reads the environment itself. |
| @@ -26,15 +27,15 @@ | ||
| 26 | 27 | * configures none. |
| 27 | 28 | */ |
| 28 | 29 | public static function getProxyForScheme(string $scheme) : ?string |
| 29 | 30 | { |
| 30 | - $scheme = \strtolower($scheme); | |
| 31 | + $scheme = \YoastSEO_Vendor\GuzzleHttp\Psr7\Utils::asciiToLower($scheme); | |
| 31 | 32 | $candidates = [$scheme . '_proxy']; |
| 32 | 33 | if ($scheme !== 'http') { |
| 33 | 34 | // Uppercase HTTP_PROXY is deliberately never consulted: a CGI |
| 34 | 35 | // request header "Proxy:" becomes HTTP_PROXY in the environment. |
| 35 | 36 | // See https://httpoxy.org for more information. |
| 36 | - $candidates[] = \strtoupper($scheme) . '_PROXY'; | |
| 37 | + $candidates[] = \YoastSEO_Vendor\GuzzleHttp\Psr7\Utils::asciiToUpper($scheme) . '_PROXY'; | |
| 37 | 38 | } |
| 38 | 39 | $candidates[] = 'all_proxy'; |
| 39 | 40 | $candidates[] = 'ALL_PROXY'; |
| 40 | 41 | foreach ($candidates as $name) { |
| @@ -69,9 +70,13 @@ | ||
| 69 | 70 | */ |
| 70 | 71 | public static function splitNoProxy(string $noProxy) : array |
| 71 | 72 | { |
| 72 | 73 | $entries = []; |
| 73 | - foreach (\preg_split('/[\\s,]+/', $noProxy) ?: [] as $entry) { | |
| 74 | + $split = \preg_split('/[\\s,]+/', $noProxy); | |
| 75 | + if ($split === \false) { | |
| 76 | + throw new \RuntimeException('Unable to split the no_proxy value: ' . \preg_last_error_msg()); | |
| 77 | + } | |
| 78 | + foreach ($split as $entry) { | |
| 74 | 79 | if ($entry !== '' && $entry[0] === '.') { |
| 75 | 80 | $entry = \substr($entry, 1); |
| 76 | 81 | } |
| 77 | 82 | if ($entry !== '') { |