private function format_url($opt)
{
$sign = $this->format_signature($opt);
if ($sign === false) {
trigger_error("Format signature failed, please check!");
return false;
}
$opt['sign'] = $sign;
$url = "";
$url .= $this->use_ssl ? 'https://' : 'http://';
$url .= $this->hostname;
$url .= '/' . $opt[self::BUCKET];
if (isset($opt[self::OBJECT]) && '/' !== $opt[self::OBJECT]) {
$url .= "/" . rawurlencode($opt[self::OBJECT]);
}
$url .= '?' . $sign;
if (isset($opt[self::QUERY_STRING])) {
foreach ($opt[self::QUERY_STRING] as $key => $value) {
$url .= '&' . $key . '=' . $value;
}
}
return $url;
}