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 5 additions and 19 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?

View File

@@ -94,7 +94,7 @@ trait FileOps
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
}
}
}
return true;
@@ -122,13 +122,11 @@ trait FileOps
retry:
$ch = curl_init();
echo "CALL $url \n";
curl_setopt($ch, CURLOPT_URL, $url);
if ($dest_fn) {
$fd = fopen($dest_fn, "w+");
curl_setopt($ch, CURLOPT_FILE, $fd);
curl_setopt($ch, CURLOPT_FILE, $fd);
} else {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
}
@@ -137,25 +135,13 @@ retry:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$token = getenv('API_TOKEN');
if (!empty($token)) {
echo "**** define authorization header ! ****\n";
var_dump(curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept: text/plain','X-custom-header: top1','Authorization: Bearer '.$token]));
}
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
echo "curl_error=". curl_error($ch) ."\n";
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
// workaround for <https://github.com/microsoft/php-sdk-binary-tools/issues/69>
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$ret = curl_exec($ch);
var_dump($ret);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (false === $ret || 200 !== $code) {