in src/OSS/OssClient.php [2835:2878]
public function generatePresignedUrl($bucket, $object, $expiration, $method = self::OSS_HTTP_GET, $options = NULL)
{
$this->precheckObjectExt($object, $this->enableStrictObjName);
$this->precheckCommon($bucket, $object, $options);
$cred = $this->provider->getCredentials();
//method
if (self::OSS_HTTP_GET !== $method && self::OSS_HTTP_PUT !== $method) {
throw new OssException("method is invalid");
}
// Should https or http be used?
$scheme = $this->useSSL ? 'https://' : 'http://';
// gets the host name. If the host name is public domain or private domain, form a third level domain by prefixing the bucket name on the domain name.
$hostname = $this->generateHostname($bucket);
$path = $this->generatePath($bucket, $object);
$headers = $this->generateHeaders($options, '');
$query_string = $this->generateQueryString($options);
$query_string = empty($query_string) ? '' : '?' . $query_string;
$requestUrl = $scheme . $hostname . $path . $query_string;
//Creates the request
$request = new RequestCore($requestUrl);
$request->set_method($method);
if (isset($options[self::OSS_CALLBACK])) {
$headers[self::OSS_CALLBACK] = base64_encode($options[self::OSS_CALLBACK]);
}
if (isset($options[self::OSS_CALLBACK_VAR])) {
$headers[self::OSS_CALLBACK_VAR] = base64_encode($options[self::OSS_CALLBACK_VAR]);
}
foreach ($headers as $header_key => $header_value) {
$header_value = trim($header_value);
if (empty($header_value)) {
continue;
}
$request->add_header($header_key, $header_value);
}
$signingOpt = array(
'bucket' => $bucket,
'key' => $object,
'region' => $this->getRegion(),
'product' => $this->getProduct(),
'expiration' => $expiration,
);
$this->signer->presign($request, $cred, $signingOpt);
return $request->request_url;
}