Skip to content

Commit d1cfc54

Browse files
committed
Merge pull request #55 from qiniu/develop
Release 6.1.4
2 parents 88d7bee + 4234beb commit d1cfc54

File tree

6 files changed

+67
-54
lines changed

6 files changed

+67
-54
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ install:
55
- sudo apt-get update && sudo apt-get install nunit mono-gmcs cli-common-dev libgl1-mesa-dev libsdl1.2-dev libopenal-dev
66

77
before_script:
8-
- export QINIU_ACCESS_KEY="iN7NgwM31j4-BZacMjPrOQBs34UG1maYCAQmhdCV"
9-
- export QINIU_SECRET_KEY="6QTOr2Jg1gcZEWDQXKOGZh5PziC2MCV5KsntT70j"
10-
- export QINIU_TEST_BUCKET="qtestbucket"
11-
- export QINIU_TEST_DOMAIN="qiniuphotos.qiniudn.com"
8+
- export QINIU_ACCESS_KEY=QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm
9+
- export QINIU_SECRET_KEY=Bxckh6FA-Fbs9Yt3i3cbKVK22UPBmAOHJcL95pGz
10+
- export QINIU_TEST_BUCKET="csharpsdk"
11+
- export QINIU_TEST_DOMAIN="csharpsdk.qiniudn.com"
1212

1313
script:
1414
- make

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## CHANGE LOG
22

3+
### v6.1.4
4+
2014-07-24 [#55](https://github.com/qiniu/csharp-sdk/pull/55)
5+
- [#54] 调整上传user agent,更新put policy
6+
7+
### v6.1.3
8+
2014-07-10 [#53](https://github.com/qiniu/csharp-sdk/pull/53)
9+
- [#52] 调整上传host
10+
311
### v6.1.2
412
2014-05-30 [#51](https://github.com/qiniu/csharp-sdk/pull/51)
513
- [#46] nuget 安装文档

Qiniu.Test/Auth/PutPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class GetPolicyTest:QiniuTestBase
2222
public void MakeRequestTest()
2323
{
2424
string actual;
25-
FileOpUrl = "http://icattlecoder-private.qiniudn.com/img.jpg?download/avialkjdf" + StringEx.ToUrlEncode("橛苛要工苛") ;
25+
FileOpUrl = "http://private-res.qiniudn.com/gogopher.jpg??download/avialkjdf" + StringEx.ToUrlEncode("橛苛要工苛") ;
2626

2727
actual = GetPolicy.MakeRequest(FileOpUrl);
2828
//System.Diagnostics.Process.Start(actual);

Qiniu.Test/IO/IOClientTest.cs

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public void PutPolicyTest(){
4040

4141

4242
policy = new PutPolicy("bucket");
43-
policy.AsyncOps="";
4443
policy.CallBackBody="uid=123";
4544
policy.CallBackUrl="www.qiniu.com";
4645
policy.DetectMime = 1;
@@ -50,11 +49,11 @@ public void PutPolicyTest(){
5049
policy.PersistentOps = "avthumb/m3u8/preset/video_16x9_440k";
5150
try {
5251
string result = policy.ToString();
53-
string expect = "{\"scope\":\"bucket\",\"callBackUrl\":\"www.qiniu.com\",\"callBackBody\":\"uid=123\",\"asyncOps\":\"\",\"deadline\":0,\"insertOnly\":1,\"detectMime\":1,\"fsizeLimit\":4096,\"persistentNotifyUrl\":\"www.yourdomain.com/persistentNotifyUrl\",\"persistentOps\":\"avthumb/m3u8/preset/video_16x9_440k\"}";
52+
string expect = "{\"scope\":\"bucket\",\"callBackUrl\":\"www.qiniu.com\",\"callBackBody\":\"uid=123\",\"deadline\":0,\"insertOnly\":1,\"detectMime\":1,\"fsizeLimit\":4096,\"persistentNotifyUrl\":\"www.yourdomain.com/persistentNotifyUrl\",\"persistentOps\":\"avthumb/m3u8/preset/video_16x9_440k\"}";
5453
Assert.IsTrue(result==expect,"PutPolicyTest Failure");
5554
} catch (Exception ee){
5655
Assert.IsTrue (false, "PutPolicyTest Failure");
57-
}
56+
}
5857

5958
}
6059

@@ -65,7 +64,7 @@ public void PutPolicyTest(){
6564
public void PutFileTest()
6665
{
6766

68-
IOClient target = new IOClient();
67+
IOClient target = new IOClient();
6968
string key = NewKey;
7069
PrintLn (key);
7170
PutExtra extra = new PutExtra (); // TODO: 初始化为适当的值
@@ -96,7 +95,7 @@ public void PutFileTest()
9695
public void PutFileWithoutKeyTest()
9796
{
9897

99-
IOClient target = new IOClient();
98+
IOClient target = new IOClient();
10099
string key = NewKey;
101100
PrintLn (key);
102101
PutExtra extra = new PutExtra (); // TODO: 初始化为适当的值
@@ -119,31 +118,31 @@ public void PutFileWithoutKeyTest()
119118
//target.PutFile("error", "error", "error", null);
120119
Assert.IsTrue (ret.OK, "PutFileTest Failure");
121120

122-
}
123-
[Test]
124-
public void PutTest()
125-
{
126-
IOClient target = new IOClient();
127-
string key = NewKey;
128-
PrintLn(key);
129-
PutExtra extra = new PutExtra(); // TODO: 初始化为适当的值
130-
extra.MimeType = "text/plain";
131-
extra.Crc32 = 123;
132-
extra.CheckCrc = CheckCrcType.CHECK;
133-
extra.Params = new System.Collections.Generic.Dictionary<string, string>();
134-
PutPolicy put = new PutPolicy(Bucket);
135-
target.PutFinished += new EventHandler<PutRet>((o, e) =>
136-
{
137-
if (e.OK)
138-
{
139-
RSHelper.RSDel(Bucket, key);
140-
}
141-
});
142-
string token = put.Token();
143-
PutRet ret = target.Put(put.Token(), key, StreamEx.ToStream("Hello, Qiniu Cloud!"), extra);
144-
145-
Assert.IsTrue(ret.OK, "PutFileTest Failure");
146-
121+
}
122+
[Test]
123+
public void PutTest()
124+
{
125+
IOClient target = new IOClient();
126+
string key = NewKey;
127+
PrintLn(key);
128+
PutExtra extra = new PutExtra(); // TODO: 初始化为适当的值
129+
extra.MimeType = "text/plain";
130+
extra.Crc32 = 123;
131+
extra.CheckCrc = CheckCrcType.CHECK;
132+
extra.Params = new System.Collections.Generic.Dictionary<string, string>();
133+
PutPolicy put = new PutPolicy(Bucket);
134+
target.PutFinished += new EventHandler<PutRet>((o, e) =>
135+
{
136+
if (e.OK)
137+
{
138+
RSHelper.RSDel(Bucket, key);
139+
}
140+
});
141+
string token = put.Token();
142+
PutRet ret = target.Put(put.Token(), key, StreamEx.ToStream("Hello, Qiniu Cloud!"), extra);
143+
144+
Assert.IsTrue(ret.OK, "PutFileTest Failure");
145+
147146
}
148147
[Test]
149148
public void PutWithoutKeyTest()

Qiniu/Conf/Config.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ namespace Qiniu.Conf
55
{
66
public class Config
77
{
8-
public static string USER_AGENT = "qiniu csharp-sdk v6.0.0";
8+
public static string VERSION = "6.1.4";
9+
10+
public static string USER_AGENT = getUa();
911
#region 帐户信息
1012
/// <summary>
1113
/// 七牛提供的公钥,用于识别用户
@@ -52,5 +54,9 @@ public static void Init()
5254
RSF_HOST = System.Configuration.ConfigurationManager.AppSettings["RSF_HOST"];
5355
PREFETCH_HOST = System.Configuration.ConfigurationManager.AppSettings["PREFETCH_HOST"];
5456
}
57+
private static string getUa()
58+
{
59+
return "QiniuCsharp/"+ VERSION + " (" + Environment.OSVersion.Version.ToString() + "; )";
60+
}
5561
}
5662
}

Qiniu/RS/PutPolicy.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ public class PutPolicy
1717
private string callBackBody;
1818
private string returnUrl;
1919
private string returnBody;
20-
private string asyncOps;
2120
private string saveKey;
2221
private int insertOnly;
2322
private int detectMime;
2423
private string mimeLimit;
2524
private long fsizeLimit;
2625
private string persistentOps;
2726
private string persistentNotifyUrl;
27+
private string persistentPipeline;
2828
private string endUser;
2929
private UInt64 expires = 3600;
3030
private UInt64 deadline = 0;
@@ -67,22 +67,13 @@ public string ReturnUrl {
6767

6868
/// <summary>
6969
/// 文件上传成功后,自定义从 Qiniu-Cloud-Server 最终返回給终端 App-Client 的数据。支持 魔法变量,不可与 callbackBody 同时使用。
70-
/// </summary>
70+
/// </summary>
7171
[JsonProperty("returnBody")]
7272
public string ReturnBody {
7373
get { return returnBody; }
7474
set { returnBody = value; }
7575
}
7676

77-
/// <summary>
78-
/// 指定文件(图片/音频/视频)上传成功后异步地执行指定的预转操作。每个预转指令是一个API规格字符串,多个预转指令可以使用分号“;”隔开
79-
/// </summary>
80-
[JsonProperty("asyncOps")]
81-
public string AsyncOps {
82-
get { return asyncOps; }
83-
set { asyncOps = value; }
84-
}
85-
8677
/// <summary>
8778
/// 给上传的文件添加唯一属主标识,特殊场景下非常有用,比如根据终端用户标识给图片或视频打水印
8879
/// </summary>
@@ -110,7 +101,7 @@ public string SaveKey {
110101
return saveKey;
111102
}
112103
set{
113-
saveKey = value;
104+
saveKey = value;
114105
}
115106
}
116107

@@ -123,7 +114,7 @@ public int InsertOnly {
123114
get {
124115
return insertOnly;
125116
}
126-
set{
117+
set{
127118
insertOnly = value;
128119
}
129120
}
@@ -138,7 +129,7 @@ public int DetectMime {
138129
return detectMime;
139130
}
140131
set{
141-
detectMime = value;
132+
detectMime = value;
142133
}
143134
}
144135

@@ -172,7 +163,7 @@ public long FsizeLimit {
172163
get {
173164
return fsizeLimit;
174165
}
175-
set{
166+
set{
176167
fsizeLimit = value;
177168
}
178169
}
@@ -187,14 +178,23 @@ public string PersistentNotifyUrl {
187178
}
188179

189180
/// <summary>
190-
/// 可指定音视频文件上传完成后,需要进行的转码持久化操作。asyncOps的处理结果保存在缓存当中,有可能失效。而persistentOps的处理结果以文件形式保存在bucket中,体验更佳。[数据处理(持久化)](http://docs.qiniu.com/api/persistent-ops.html
181+
/// 可指定音视频文件上传完成后,需要进行的转码持久化操作。persistentOps的处理结果以文件形式保存在bucket中,体验更佳。[数据处理(持久化)](http://docs.qiniu.com/api/persistent-ops.html
191182
/// </summary>
192183
[JsonProperty("persistentOps")]
193184
public string PersistentOps {
194185
get { return persistentOps; }
195186
set { persistentOps = value; }
196187
}
197188

189+
// <summary>
190+
/// 可指定音视频文件上传后处理的队列,不指定时在公共队列中。persistentOps的处理结果以文件形式保存在bucket中,体验更佳。[数据处理(持久化)](http://docs.qiniu.com/api/persistent-ops.html
191+
/// </summary>
192+
[JsonProperty("persistentPipeline")]
193+
public string PersistentPipeline {
194+
get { return persistentPipeline; }
195+
set { persistentPipeline = value; }
196+
}
197+
198198
/// <summary>
199199
/// Initializes a new instance of the <see cref="Qiniu.RS.PutPolicy"/> class.
200200
/// </summary>
@@ -217,15 +217,15 @@ public string Token (Mac mac=null)
217217
}
218218
if (string.IsNullOrEmpty (callBackUrl) ^ string.IsNullOrEmpty (callBackBody)) {
219219
throw new Exception ("CallBackUrl and CallBackBody error");
220-
}
220+
}
221221
if (!string.IsNullOrEmpty (returnUrl) && !string.IsNullOrEmpty (callBackUrl)) {
222222
throw new Exception ("returnUrl and callBackUrl error");
223223
}
224224
if (mac == null) {
225225
mac = new Mac (Config.ACCESS_KEY, Config.Encoding.GetBytes (Config.SECRET_KEY));
226226
}
227227
this.deadline = (UInt32)((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 + (long)expires);
228-
string flag = this.ToString ();
228+
string flag = this.ToString ();
229229
return mac.SignWithData (Config.Encoding.GetBytes (flag));
230230
}
231231

0 commit comments

Comments
 (0)