Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 91302e8

Browse files
committed
Use SSL explicitly for communitation with windows.php.net
1 parent f655bcf commit 91302e8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

lib/php/libsdk/SDK/Build/Dependency/Fetcher.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ class Fetcher
1515
protected $series;
1616

1717

18-
public function __construct(string $host, int $port, string $arch = NULL, string $stability = NULL, Series $series = NULL)
18+
public function __construct(string $host, int $port, string $scheme = "https", string $arch = NULL, string $stability = NULL, Series $series = NULL)
1919
{/*{{{*/
2020
$this->stability = $stability;
2121
$this->arch = $arch;
2222
$this->host = $host;
2323
$this->port = $port;
24+
$this->scheme = $scheme;
2425
}/*}}}*/
2526

2627
public function getSeries() : Series
@@ -37,7 +38,7 @@ public function setSeries(Series $series) : void
3738
/* TODO implement indicator. */
3839
public function getByUri(string $uri, int $retries = 3) : string
3940
{/*{{{*/
40-
$url = "http://{$this->host}:{$this->port}$uri";
41+
$url = "{$this->scheme}://{$this->host}:{$this->port}$uri";
4142
$ret = false;
4243

4344
retry:

lib/php/libsdk/SDK/Build/Dependency/Manager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function __construct(string $path, string $stability, string $arch)
2424

2525
$host = Config::getDepsHost();
2626
$port = Config::getDepsPort();
27-
$fetcher = new Fetcher($host, $port, $this->arch, $this->stability);
27+
$scheme = Config::getDepsUriScheme();
28+
$fetcher = new Fetcher($host, $port, $scheme, $this->arch, $this->stability);
2829
$series = new Series($this->stability, $this->arch, $this->cache, NULL);
2930
$fetcher->setSeries($series);
3031
$series->setFetcher($fetcher);

lib/php/libsdk/SDK/Config.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class Config
1010
{
1111
/* Config variables. */
1212
protected static $depsHost = 'windows.php.net';
13-
protected static $depsPort = 80;
13+
protected static $depsPort = 443;
14+
protected static $depsUriScheme = "https";
1415
protected static $depsBaseUri = "/downloads/php-sdk/deps";
1516

1617
/* protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; */
@@ -34,6 +35,11 @@ public static function getDepsPort() : string
3435
return self::$depsPort;
3536
}/*}}}*/
3637

38+
public static function getDepsUriScheme() : string
39+
{/*{{{*/
40+
return self::$depsUriScheme;
41+
}/*}}}*/
42+
3743
public static function getDepsBaseUri() : string
3844
{/*{{{*/
3945
return self::$depsBaseUri;
@@ -125,7 +131,7 @@ public static function getKnownBranches() : array
125131
if (empty(self::$knownBranches)) {
126132
$cache_file = "known_branches.txt";
127133
$cache = new Cache(self::getDepsLocalPath());
128-
$fetcher = new Fetcher(self::$depsHost, self::$depsPort);
134+
$fetcher = new Fetcher(self::$depsHost, self::$depsPort, self::$depsUriScheme);
129135

130136
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
131137
if (false !== $tmp) {

0 commit comments

Comments
 (0)