Compare commits

..

7 Commits

Author SHA1 Message Date
macintoshplus
8aba2baa77 restore user agent after fix the content 2024-11-13 22:07:58 +01:00
Jean-Baptiste Nahan
6732622355 change useragent 2024-11-13 11:44:43 +01:00
Jean-Baptiste Nahan
c705dce0c0 change useragent 2024-11-13 11:43:58 +01:00
Jean-Baptiste Nahan
aa22e335c8 change user agent 2024-11-13 11:37:48 +01:00
Jean-Baptiste Nahan
52b83f957e try change order opt curl 2024-11-13 11:09:33 +01:00
Jean-Baptiste Nahan
251cd72e6e add debug info 2024-11-13 10:55:08 +01:00
Jean-Baptiste Nahan
bdec9f92b9 add var_dump on set headers 2024-11-13 10:35:41 +01:00
2 changed files with 17 additions and 11 deletions

View File

@@ -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

@@ -94,7 +94,7 @@ trait FileOps
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
}
}
}
return true;
@@ -128,28 +128,34 @@ retry:
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);
}
//curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HEADER, true);
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);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$token = getenv('API_TOKEN');
if (!empty($token)) {
echo "**** define authorization header ! ****\n";
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-custom-header: top1','Authorization: Bearer '.$token]);
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";
// 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) {