public override Uri GetUriInternal(string path)
 {
     return(new Uri(SecureHelper.IsSecure() ? _bucketSSlRoot : _bucketRoot, path));
 }
 private Uri GetUriShared(string domain, string path)
 {
     return(new Uri(String.Format("{0}{1}/{2}", SecureHelper.IsSecure() ? _cnameSSL : _cname, _public_container, MakePath(domain, path))));
 }
示例#3
0
 public Uri GetUriShared(string domain, string path)
 {
     return(new Uri(SecureHelper.IsSecure(HttpContextAccessor.HttpContext, Options) ? _bucketSSlRoot : _bucketRoot, MakePath(domain, path)));
 }
示例#4
0
 public Uri GetUriShared(string domain, string path)
 {
     return(new Uri(SecureHelper.IsSecure() ? _bucketSSlRoot : _bucketRoot, MakePath(domain, path)));
 }
示例#5
0
        public override Uri GetInternalUri(string domain, string path, TimeSpan expire, IEnumerable <string> headers)
        {
            if (expire == TimeSpan.Zero || expire == TimeSpan.MinValue || expire == TimeSpan.MaxValue)
            {
                expire = GetExpire(domain);
            }
            if (expire == TimeSpan.Zero || expire == TimeSpan.MinValue || expire == TimeSpan.MaxValue)
            {
                return(GetUriShared(domain, path));
            }

            var pUrlRequest = new GetPreSignedUrlRequest
            {
                BucketName = _bucket,
                Expires    = DateTime.UtcNow.Add(expire),
                Key        = MakePath(domain, path),
                Protocol   = SecureHelper.IsSecure() ? Protocol.HTTPS : Protocol.HTTP,
                Verb       = HttpVerb.GET
            };

            if (headers != null && headers.Any())
            {
                var headersOverrides = new ResponseHeaderOverrides();

                foreach (var h in headers)
                {
                    if (h.StartsWith("Content-Disposition"))
                    {
                        headersOverrides.ContentDisposition = (h.Substring("Content-Disposition".Length + 1));
                    }
                    else if (h.StartsWith("Cache-Control"))
                    {
                        headersOverrides.CacheControl = (h.Substring("Cache-Control".Length + 1));
                    }
                    else if (h.StartsWith("Content-Encoding"))
                    {
                        headersOverrides.ContentEncoding = (h.Substring("Content-Encoding".Length + 1));
                    }
                    else if (h.StartsWith("Content-Language"))
                    {
                        headersOverrides.ContentLanguage = (h.Substring("Content-Language".Length + 1));
                    }
                    else if (h.StartsWith("Content-Type"))
                    {
                        headersOverrides.ContentType = (h.Substring("Content-Type".Length + 1));
                    }
                    else if (h.StartsWith("Expires"))
                    {
                        headersOverrides.Expires = (h.Substring("Expires".Length + 1));
                    }
                    else
                    {
                        throw new FormatException(string.Format("Invalid header: {0}", h));
                    }
                }
                pUrlRequest.ResponseHeaderOverrides = headersOverrides;
            }
            using (var client = GetClient())
            {
                return(MakeUri(client.GetPreSignedURL(pUrlRequest)));
            }
        }
示例#6
0
 private Uri GetUriShared(string domain, string path)
 {
     return(new Uri(string.Format("{0}{1}", SecureHelper.IsSecure(HttpContextAccessor?.HttpContext, Options) ? _cnameSSL : _cname, MakePath(domain, path))));
 }