Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <mattab@users.noreply.github.com>2017-09-20 14:02:48 +0300
committerGitHub <noreply@github.com>2017-09-20 14:02:48 +0300
commite4750236c6668b9126271cc6eef02256a64ec9f0 (patch)
tree2020b521ec738402a0c522c081a10f4ef56ddbdb /core/Http.php
parent3689b2ae2a262d2d86df5ea7c1d0e9ceda287ea7 (diff)
Use Piwik.org in our HTTP Socket integration test (#12074)
* Use Piwik.org in our HTTP Socket integration test * use exact "piwik.org" in HTTP socket integration test * use "ssl://" if necessary for HTTP socket * divert from spec to please HTTP socket test
Diffstat (limited to 'core/Http.php')
-rw-r--r--core/Http.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/Http.php b/core/Http.php
index 3ad1b2ce39..59628852ab 100644
--- a/core/Http.php
+++ b/core/Http.php
@@ -213,7 +213,7 @@ class Http
throw new Exception('Invalid protocol/scheme: ' . $url['scheme']);
}
$host = $url['host'];
- $port = isset($url['port']) ? $url['port'] : 80;
+ $port = isset($url['port']) ? $url['port'] : ('https' == $url['scheme'] ? 443 : 80);
$path = isset($url['path']) ? $url['path'] : '/';
if (isset($url['query'])) {
$path .= '?' . $url['query'];
@@ -241,6 +241,10 @@ class Http
$connectHost = $host;
$connectPort = $port;
$requestHeader = "$httpMethod $path HTTP/$httpVer\r\n";
+
+ if ('https' == $url['scheme']) {
+ $connectHost = 'ssl://' . $connectHost;
+ }
}
// connection attempt
@@ -258,7 +262,7 @@ class Http
// send HTTP request header
$requestHeader .=
- "Host: $host" . ($port != 80 ? ':' . $port : '') . "\r\n"
+ "Host: $host" . ($port != 80 && ('https' == $url['scheme'] && $port != 443) ? ':' . $port : '') . "\r\n"
. ($httpAuth ? $httpAuth : '')
. ($proxyAuth ? $proxyAuth : '')
. 'User-Agent: ' . $userAgent . "\r\n"