Compare commits

..

5 Commits

Author SHA1 Message Date
Jean-Baptiste Nahan
154b63fb2e add log for http call 2024-11-13 09:11:12 +01:00
Jean-Baptiste Nahan
b9530450e2 try other header 2024-11-13 00:03:24 +01:00
Jean-Baptiste Nahan
c74c3b5b94 add log 2024-11-12 23:12:24 +01:00
Jean-Baptiste Nahan
53afca7edb Add header if API_TOKEN is present 2024-11-12 22:59:25 +01:00
Jean-Baptiste Nahan
96d8b2f49a change hostname and url to download in Config.php 2024-11-12 21:56:35 +01:00
2 changed files with 17 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ class Config
/* Config variables. */
/** @var string */
protected static $depsHost = 'downloads.php.net';
protected static $depsHost = 'phpext.phptools.online';
/** @var int */
protected static $depsPort = 443;
@@ -18,7 +18,7 @@ class Config
protected static $depsUriScheme = "https";
/** @var string */
protected static $depsBaseUri = "/~windows/php-sdk/deps";
protected static $depsBaseUri = "/api/downloadable/download";
/** @var string */
protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; // experimental?
@@ -218,7 +218,7 @@ class Config
}
/* Try to figure out the branch. The worky scenarios are
- CWD is in php-src
- CWD is in php-src
- phpize is on the path
FIXME for the dev package, there should be a php-config utility
*/
@@ -256,7 +256,7 @@ class Config
$cmd = "\"$git\" branch";
$ret = trim(shell_exec($cmd));
if (preg_match_all(",\*\s+master,", $ret) > 0) {
if (preg_match_all(",\*\s+master,", $ret) > 0) {
$branch = "master";
}
}
@@ -271,7 +271,7 @@ class Config
$branch = self::guessCurrentBranchName();
self::setCurrentBranchName($branch);
}
return self::$currentBranchName;
}/*}}}*/
@@ -336,7 +336,7 @@ class Config
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
}
return $ret;
return $ret;
}/*}}}*/
public static function getSdkNugetFeedUrl() : string
@@ -368,7 +368,7 @@ class Config
throw new Exception("Couldn't find the SDK version file.");
}
return trim(file_get_contents($path));
return file_get_contents($path);
}/*}}}*/
public static function getDepsLocalPath() : ?string
@@ -391,7 +391,7 @@ class Config
self::setDepsLocalPath($tmp);
}
}
if (NULL == self::$depsLocalPath) {
$tmp = realpath("../deps");
if (is_dir($tmp)) {

View File

@@ -122,6 +122,8 @@ trait FileOps
retry:
$ch = curl_init();
echo "CALL $url \n";
curl_setopt($ch, CURLOPT_URL, $url);
if ($dest_fn) {
@@ -131,13 +133,19 @@ retry:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
}
curl_setopt($ch, CURLOPT_HEADER, false);
//curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$token = getenv('API_TOKEN');
if (!empty($token)) {
echo "**** define authorization header ! ****\n";
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-custom-header: top1','Authorization: Bearer '.$token]);
}
// workaround for <https://github.com/microsoft/php-sdk-binary-tools/issues/69>
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);