Esempio n. 1
0
 /**
  * Perform request using Microsoft_Http_Transport channel
  *
  * @param string $path Path
  * @param string $queryString Query string
  * @param string $httpVerb HTTP verb the request will use
  * @param array $headers x-ms headers to add
  * @param boolean $forTableStorage Is the request for table storage?
  * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
  * @param string $resourceType Resource type
  * @param string $requiredPermission Required permission
  * @return Microsoft_Http_Response
  */
 protected function performRequest($path = '/', $queryString = '', $httpVerb = Microsoft_Http_Transport::VERB_GET, $headers = array(), $forTableStorage = false, $rawData = null, $resourceType = Microsoft_WindowsAzure_Storage::RESOURCE_UNKNOWN, $requiredPermission = Microsoft_WindowsAzure_Credentials::PERMISSION_READ)
 {
     // Clean path
     if (strpos($path, '/') !== 0) {
         $path = '/' . $path;
     }
     // Clean headers
     if (is_null($headers)) {
         $headers = array();
     }
     // Add version header
     $headers['x-ms-version'] = $this->_apiVersion;
     // URL encoding
     $path = self::urlencode($path);
     $queryString = self::urlencode($queryString);
     // Generate URL and sign request
     $requestUrl = $this->_credentials->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
     $requestHeaders = $this->_credentials->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission);
     $requestClient = Microsoft_Http_Transport::createChannel();
     if ($this->_useProxy) {
         $requestClient->setProxy($this->_useProxy, $this->_proxyUrl, $this->_proxyPort, $this->_proxyCredentials);
     }
     $response = $this->_retryPolicy->execute(array($requestClient, 'request'), array($httpVerb, $requestUrl, array(), $requestHeaders, $rawData));
     $requestClient = null;
     unset($requestClient);
     return $response;
 }
 /**
  * Creates a new Microsoft_WindowsAzure_SharedAccessSignatureCredentials instance
  *
  * @param string $accountName Account name for Windows Azure
  * @param string $accountKey Account key for Windows Azure
  * @param boolean $usePathStyleUri Use path-style URI's
  * @param array $permissionSet Permission set
  */
 public function __construct($accountName = Microsoft_WindowsAzure_Credentials::DEVSTORE_ACCOUNT, $accountKey = Microsoft_WindowsAzure_Credentials::DEVSTORE_KEY, $usePathStyleUri = false, $permissionSet = array())
 {
     parent::__construct($accountName, $accountKey, $usePathStyleUri);
     $this->_permissionSet = $permissionSet;
 }