Compare commits

..

1 Commits

Author SHA1 Message Date
macintoshplus
a992318304 fix bug send useragent with new line char 2024-11-13 21:58:01 +01:00
2 changed files with 9 additions and 17 deletions

View File

@@ -9,7 +9,7 @@ class Config
/* Config variables. */
/** @var string */
protected static $depsHost = 'phpext.phptools.online';
protected static $depsHost = 'downloads.php.net';
/** @var int */
protected static $depsPort = 443;
@@ -18,7 +18,7 @@ class Config
protected static $depsUriScheme = "https";
/** @var string */
protected static $depsBaseUri = "/api/downloadable/download";
protected static $depsBaseUri = "/~windows/php-sdk/deps";
/** @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 file_get_contents($path);
return trim(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,8 +122,6 @@ trait FileOps
retry:
$ch = curl_init();
echo "CALL $url \n";
curl_setopt($ch, CURLOPT_URL, $url);
if ($dest_fn) {
@@ -133,19 +131,13 @@ 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";
var_dump(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);