Skip to content
Extraits de code Groupes Projets
Valider e4750236 rédigé par Matthieu Aubry's avatar Matthieu Aubry Validation de GitHub
Parcourir les fichiers

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
parent 3689b2ae
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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"
......
......@@ -289,7 +289,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase
public function testSocketHttpsWorksWithValidCertificate()
{
$result = Http::sendHttpRequestBy('socket', 'https://www.google.com/', 10);
$result = Http::sendHttpRequestBy('socket', 'https://piwik.org/', 10);
$this->assertNotEmpty($result);
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter