Skip to content

Commit

Permalink
Latest Cloud Storage Server SDK.
Browse files Browse the repository at this point in the history
  • Loading branch information
cubiclesoft committed Oct 7, 2017
1 parent 96b80cb commit 75c8089
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
16 changes: 13 additions & 3 deletions support/sdk_cloud_storage_server_files.php
Expand Up @@ -372,15 +372,25 @@ private function RunAPI($method, $apipath, $options = array(), $expected = 200,

$this->fp = $result["fp"];
$url = $result["url"];
}

if ($this->fp !== false)
{
$options2 = array(
"fp" => $this->fp,
"method" => $method,
"headers" => array(
"Connection" => "keep-alive",
"X-APIKey" => $this->apikey
)
);
}
else if ($this->fp !== false)
{
$url = RemotedAPI::ExtractRealHost($url);

$options2 = array(
"fp" => $this->fp,
"method" => $method,
"headers" => array(
"Connection" => "keep-alive"
)
);
}
Expand Down
11 changes: 11 additions & 0 deletions support/sdk_remotedapi.php
Expand Up @@ -10,6 +10,17 @@ public static function IsRemoted($url)
return (strtolower(substr($url, 0, 6)) === "rwr://" || strtolower(substr($url, 0, 7)) === "rwrs://");
}

public static function ExtractRealHost($url)
{
$urls = explode(" ", preg_replace('/\s+/', " ", $url));
foreach ($urls as $url)
{
if (strtolower(substr($url, 0, 6)) !== "rwr://" && strtolower(substr($url, 0, 7)) !== "rwrs://") return $url;
}

return "";
}

// Expected URL format: rwr://clientapikey@host/webroutepath
// Where 'clientapikey' is the Remoted API server client API key and 'webroutepath' is the path to a connected remoted API.
// Multiple layers can be specified by separating URLs with spaces.
Expand Down

0 comments on commit 75c8089

Please sign in to comment.