/// <summary>
        /// get source with urlEncode
        /// </summary>
        /// <returns></returns>
        public string GetCopySouce()
        {
            if (!key.StartsWith("/"))
            {
                key = "/" + key;
            }
            StringBuilder copySource = new StringBuilder();

            copySource.Append(bucket);
            if (!bucket.EndsWith("-" + appid))
            {
                copySource.Append("-")
                .Append(appid);
            }
            copySource.Append(".").Append("cos").Append(".")
            .Append(region).Append(".")
            .Append("myqcloud.com")
            .Append(URLEncodeUtils.EncodePathOfURL(key));

            if (versionId != null)
            {
                copySource.Append("?versionId=").Append(versionId);
            }
            return(copySource.ToString());
        }
Пример #2
0
        private HttpUrl CreateUrl(CosRequest cosRequest)
        {
            HttpUrl httpUrl = new HttpUrl();

            httpUrl.Scheme = (bool)cosRequest.IsHttps ? "https" : "http";
            httpUrl.Host   = cosRequest.GetHost();
            httpUrl.Path   = URLEncodeUtils.EncodePathOfURL(cosRequest.RequestPath);
            httpUrl.SetQueryParameters(cosRequest.GetRequestParamters());
            return(httpUrl);
        }