Skip to content

Commit a3a3b65

Browse files
authored
Merge pull request #2524 from Nixxeee/master
Fix: Connectivity check fails with Squid/Strict Proxies (Force CONNECT on port 80)
2 parents 712a2c9 + 5c96cdd commit a3a3b65

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

emhttp/plugins/dynamix/include/OutgoingProxyLib.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,17 @@ function proxy_online($proxyUrl) {
5858
$rc = true;
5959

6060
if ($proxyUrl) {
61+
/*Define the check URL */
62+
$checkurl = "http://www.msftncsi.com/ncsi.txt";
6163
/* Initialize cURL session. */
62-
$ch = curl_init("http://www.msftncsi.com/ncsi.txt");
63-
64+
$ch = curl_init($checkurl);
65+
66+
/* Determine if tunneling is needed (HTTPS only). */
67+
$isHttps = (parse_url($checkurl, PHP_URL_SCHEME) === 'https');
68+
6469
/* Set cURL options. */
6570
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); /* Timeout in seconds. */
66-
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
71+
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $isHttps); /* Enable HTTP tunneling only for HTTPS to prevent CONNECT method on port 80. */
6772
curl_setopt($ch, CURLOPT_PROXY, $proxyUrl); /* Url is a proxy. */
6873
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); /* Return transfer as a string. */
6974

0 commit comments

Comments
 (0)