AddDateHeader() 공개 정적인 메소드

public static AddDateHeader ( Hashtable headers ) : void
headers System.Collections.Hashtable
리턴 void
예제 #1
0
        // see http://msdn.microsoft.com/en-us/library/dd179428.aspx for authentication details
        public HttpResponse DoBlobStoreRequest(string containername, string blobname, string method, Hashtable headers, byte[] data, string content_type, string query_string)
        {
            string path = "/";

            if (containername != null)
            {
                containername = LegalizeContainerName(containername);
                path          = path + containername;
                if (blobname != null)
                {
                    path = path + "/" + blobname;
                }
            }

            StorageUtils.AddDateHeader(headers);
            StorageUtils.AddVersionHeader(headers);

            string auth_header = StorageUtils.MakeSharedKeyLiteHeader(StorageUtils.services.blob, this.azure_storage_account, this.azure_b64_secret, method, path, query_string, content_type, headers);

            headers["Authorization"] = "SharedKeyLite " + this.azure_storage_account + ":" + auth_header;

            Uri uri = new Uri(string.Format("http://{0}{1}{2}", this.azure_blob_host, path, query_string));

            //return StorageUtils.DoStorageRequest(method, headers, data, content_type, uri);
            return(HttpUtils.RetryStorageRequestExpectingServiceAvailable(method, headers, data, content_type, uri));
        }
예제 #2
0
        // generic table request
        public HttpResponse DoTableStoreRequest(string request_path, string query_string, string method, Hashtable headers, byte[] data)
        {
            string path = "/";

            if (request_path != null)
            {
                path += request_path;
            }

            StorageUtils.AddDateHeader(headers);
            StorageUtils.AddVersionHeader(headers);
            headers.Add("DataServiceVersion", DataServiceVersion);
            headers.Add("MaxDataServiceVersion", MaxDataServiceVersion);
            string auth_header = StorageUtils.MakeSharedKeyLiteHeader(StorageUtils.services.table, this.azure_storage_name, this.azure_b64_secret, http_method: null, path: path, query_string: null, content_type: TABLE_STORAGE_CONTENT_TYPE, headers: headers);

            headers["Authorization"] = "SharedKeyLite " + this.azure_storage_name + ":" + auth_header;

            if (query_string != null)
            {
                path = path + "?" + query_string;
            }

            Uri uri = new Uri(string.Format("{0}://{1}{2}", this.scheme, this.azure_table_host, path));

            // return StorageUtils.DoStorageRequest(method, headers, data: data, content_type: TABLE_STORAGE_CONTENT_TYPE, uri: uri);
            return(HttpUtils.RetryStorageRequestExpectingServiceAvailable(method, headers, data: data, content_type: TABLE_STORAGE_CONTENT_TYPE, uri: uri));
        }