Skip to content

Commit 9ba5ae7

Browse files
committed
Merge pull request #44 from longbai/token_parse
token_parse
2 parents 3311288 + 03c3ff4 commit 9ba5ae7

19 files changed

+1117
-40
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#Changelog
22

3+
## 7.0.11 (2015-06-07)
4+
5+
### 增加
6+
* 上传前 检查token
7+
* 支持指定服务器端口
8+
39
## 7.0.10 (2015-05-23)
410

511
### 增加

Qiniu.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Qiniu'
3-
s.version = '7.0.10'
3+
s.version = '7.0.11'
44
s.summary = 'Qiniu Resource Storage SDK for iOS and Mac'
55
s.homepage = 'https://github.com/qiniu/objc-sdk'
66
s.social_media_url = 'http://weibo.com/qiniutek'

QiniuSDK.xcodeproj/project.pbxproj

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@
5959
DF3C504819DD7BA6000F548F /* QNFormUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3C504619DD7BA6000F548F /* QNFormUploadTest.m */; };
6060
DF3C504A19DD7D9F000F548F /* QNResumeUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3C504919DD7D9F000F548F /* QNResumeUploadTest.m */; };
6161
DF3C504B19DD7D9F000F548F /* QNResumeUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3C504919DD7D9F000F548F /* QNResumeUploadTest.m */; };
62+
DF437CD21B2426270099587B /* GTM_Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = DF437CD01B2426270099587B /* GTM_Base64.h */; };
63+
DF437CD31B2426270099587B /* GTM_Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD11B2426270099587B /* GTM_Base64.m */; };
64+
DF437CD41B2426270099587B /* GTM_Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD11B2426270099587B /* GTM_Base64.m */; };
65+
DF437CD51B2426270099587B /* GTM_Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD11B2426270099587B /* GTM_Base64.m */; };
66+
DF437CD61B2426270099587B /* GTM_Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD11B2426270099587B /* GTM_Base64.m */; };
67+
DF437CD91B2429E10099587B /* QNUpToken.h in Headers */ = {isa = PBXBuildFile; fileRef = DF437CD71B2429E10099587B /* QNUpToken.h */; };
68+
DF437CDA1B2429E10099587B /* QNUpToken.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD81B2429E10099587B /* QNUpToken.m */; };
69+
DF437CDB1B2429E10099587B /* QNUpToken.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD81B2429E10099587B /* QNUpToken.m */; };
70+
DF437CDC1B2429E10099587B /* QNUpToken.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD81B2429E10099587B /* QNUpToken.m */; };
71+
DF437CDD1B2429E10099587B /* QNUpToken.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CD81B2429E10099587B /* QNUpToken.m */; };
72+
DF437CDF1B243A2C0099587B /* QNUpTokenTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CDE1B243A2C0099587B /* QNUpTokenTest.m */; };
73+
DF437CE01B243A2C0099587B /* QNUpTokenTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF437CDE1B243A2C0099587B /* QNUpTokenTest.m */; };
6274
DF482FD81B0DA8A2000DAD98 /* QNConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = DF482FD61B0DA8A2000DAD98 /* QNConfiguration.h */; };
6375
DF482FD91B0DA8A2000DAD98 /* QNConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = DF482FD71B0DA8A2000DAD98 /* QNConfiguration.m */; };
6476
DF482FDA1B0DA8A2000DAD98 /* QNConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = DF482FD71B0DA8A2000DAD98 /* QNConfiguration.m */; };
@@ -167,6 +179,11 @@
167179
DF2CDE7019DAE90300CE01FB /* QNBase64Test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNBase64Test.m; sourceTree = "<group>"; };
168180
DF3C504619DD7BA6000F548F /* QNFormUploadTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNFormUploadTest.m; sourceTree = "<group>"; };
169181
DF3C504919DD7D9F000F548F /* QNResumeUploadTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNResumeUploadTest.m; sourceTree = "<group>"; };
182+
DF437CD01B2426270099587B /* GTM_Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTM_Base64.h; sourceTree = "<group>"; };
183+
DF437CD11B2426270099587B /* GTM_Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTM_Base64.m; sourceTree = "<group>"; };
184+
DF437CD71B2429E10099587B /* QNUpToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QNUpToken.h; sourceTree = "<group>"; };
185+
DF437CD81B2429E10099587B /* QNUpToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNUpToken.m; sourceTree = "<group>"; };
186+
DF437CDE1B243A2C0099587B /* QNUpTokenTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNUpTokenTest.m; sourceTree = "<group>"; };
170187
DF482FD61B0DA8A2000DAD98 /* QNConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QNConfiguration.h; sourceTree = "<group>"; };
171188
DF482FD71B0DA8A2000DAD98 /* QNConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNConfiguration.m; sourceTree = "<group>"; };
172189
DF6099F91A5676AA00AC7297 /* QNDns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QNDns.h; sourceTree = "<group>"; };
@@ -328,6 +345,8 @@
328345
DF2CDE5719DAC6A400CE01FB /* QNVersion.h */,
329346
DFA9B63919DF904000A15FD1 /* QNEtag.h */,
330347
DFA9B63A19DF904000A15FD1 /* QNEtag.m */,
348+
DF437CD01B2426270099587B /* GTM_Base64.h */,
349+
DF437CD11B2426270099587B /* GTM_Base64.m */,
331350
);
332351
path = Common;
333352
sourceTree = "<group>";
@@ -346,6 +365,8 @@
346365
DF609A041A58E39D00AC7297 /* QNFormUpload.m */,
347366
DF482FD61B0DA8A2000DAD98 /* QNConfiguration.h */,
348367
DF482FD71B0DA8A2000DAD98 /* QNConfiguration.m */,
368+
DF437CD71B2429E10099587B /* QNUpToken.h */,
369+
DF437CD81B2429E10099587B /* QNUpToken.m */,
349370
);
350371
path = Storage;
351372
sourceTree = "<group>";
@@ -365,6 +386,7 @@
365386
DFFE0E5F19E6575600D7A0FC /* QNFileRecorderTest.m */,
366387
DF609A001A5839B400AC7297 /* QNDnsTest.m */,
367388
DFF525381A64079B00D02BA1 /* QNSessionTest.m */,
389+
DF437CDE1B243A2C0099587B /* QNUpTokenTest.m */,
368390
);
369391
path = QiniuSDKTests;
370392
sourceTree = SOURCE_ROOT;
@@ -388,9 +410,11 @@
388410
files = (
389411
DF0D23CD19DCE6C400D6B68F /* QNResponseInfo.h in Headers */,
390412
DF6099FA1A5676AA00AC7297 /* QNDns.h in Headers */,
413+
DF437CD21B2426270099587B /* GTM_Base64.h in Headers */,
391414
DF293C9E19DBC2AE00799011 /* QNUserAgent.h in Headers */,
392415
DF2CDE6719DAC6A400CE01FB /* QNVersion.h in Headers */,
393416
DF293CA419DC04C200799011 /* QNHttpManager.h in Headers */,
417+
DF437CD91B2429E10099587B /* QNUpToken.h in Headers */,
394418
DFA9B65819E0B53700A15FD1 /* QNFileRecorder.h in Headers */,
395419
DF482FD81B0DA8A2000DAD98 /* QNConfiguration.h in Headers */,
396420
DF609A051A58E39D00AC7297 /* QNFormUpload.h in Headers */,
@@ -678,13 +702,15 @@
678702
DF2CDE5D19DAC6A400CE01FB /* QNUrlSafeBase64.m in Sources */,
679703
DF0D23CF19DCE6E500D6B68F /* QNResponseInfo.m in Sources */,
680704
DFA9B63C19DF904000A15FD1 /* QNEtag.m in Sources */,
705+
DF437CD31B2426270099587B /* GTM_Base64.m in Sources */,
681706
DF482FD91B0DA8A2000DAD98 /* QNConfiguration.m in Sources */,
682707
DF609A061A58E39D00AC7297 /* QNFormUpload.m in Sources */,
683708
DF293C9F19DBC2AE00799011 /* QNUserAgent.m in Sources */,
684709
DFA9B65919E0B53700A15FD1 /* QNFileRecorder.m in Sources */,
685710
DF2CDE6119DAC6A400CE01FB /* QNCrc32.m in Sources */,
686711
DF293CA619DC05B800799011 /* QNHttpManager.m in Sources */,
687712
DF293CAB19DC0E5300799011 /* QNResumeUpload.m in Sources */,
713+
DF437CDA1B2429E10099587B /* QNUpToken.m in Sources */,
688714
DFF525321A6235D100D02BA1 /* QNSessionManager.m in Sources */,
689715
DFA39AA519F1272800A1A158 /* QNAsyncRun.m in Sources */,
690716
DFA9B64A19E0018800A15FD1 /* QNUploadOption.m in Sources */,
@@ -704,11 +730,13 @@
704730
DFA9B64219DFDA6800A15FD1 /* QNEtag.m in Sources */,
705731
DF3C504719DD7BA6000F548F /* QNFormUploadTest.m in Sources */,
706732
DF609A011A5839B400AC7297 /* QNDnsTest.m in Sources */,
733+
DF437CDF1B243A2C0099587B /* QNUpTokenTest.m in Sources */,
707734
DF0D23D219DCF02C00D6B68F /* QNResponseInfo.m in Sources */,
708735
DFBC622519DE459800458C4B /* QNHttpTest.m in Sources */,
709736
DF0D23C919DCC5B800D6B68F /* QNUserAgent.m in Sources */,
710737
DFA39AA619F1272800A1A158 /* QNAsyncRun.m in Sources */,
711738
DF0D23C819DCC5B200D6B68F /* QNHttpManager.m in Sources */,
739+
DF437CDB1B2429E10099587B /* QNUpToken.m in Sources */,
712740
DF0D23C719DCC58000D6B68F /* QNResumeUpload.m in Sources */,
713741
DF2CDE8019DAF67F00CE01FB /* QNUrlSafeBase64.m in Sources */,
714742
DF3C504A19DD7D9F000F548F /* QNResumeUploadTest.m in Sources */,
@@ -718,6 +746,7 @@
718746
DFF525391A64079B00D02BA1 /* QNSessionTest.m in Sources */,
719747
DF609A071A58E39D00AC7297 /* QNFormUpload.m in Sources */,
720748
DFF525331A6235D100D02BA1 /* QNSessionManager.m in Sources */,
749+
DF437CD41B2426270099587B /* GTM_Base64.m in Sources */,
721750
DFA9B63F19DFD8C900A15FD1 /* QNEtagTest.m in Sources */,
722751
DF6099FD1A5676CA00AC7297 /* QNDns.m in Sources */,
723752
DF2CDE8A19DAF67F00CE01FB /* QNUploadManager.m in Sources */,
@@ -732,13 +761,15 @@
732761
DF2CDE5E19DAC6A400CE01FB /* QNUrlSafeBase64.m in Sources */,
733762
DF0D23D019DCE6E500D6B68F /* QNResponseInfo.m in Sources */,
734763
DFA9B63D19DF904000A15FD1 /* QNEtag.m in Sources */,
764+
DF437CD51B2426270099587B /* GTM_Base64.m in Sources */,
735765
DF482FDA1B0DA8A2000DAD98 /* QNConfiguration.m in Sources */,
736766
DF609A081A58E39D00AC7297 /* QNFormUpload.m in Sources */,
737767
DF293CA019DBC2AE00799011 /* QNUserAgent.m in Sources */,
738768
DFA9B65A19E0B53700A15FD1 /* QNFileRecorder.m in Sources */,
739769
DF2CDE6219DAC6A400CE01FB /* QNCrc32.m in Sources */,
740770
DF293CA719DC05B800799011 /* QNHttpManager.m in Sources */,
741771
DF293CAC19DC0E5300799011 /* QNResumeUpload.m in Sources */,
772+
DF437CDC1B2429E10099587B /* QNUpToken.m in Sources */,
742773
DFF525341A6235D100D02BA1 /* QNSessionManager.m in Sources */,
743774
DFA39AA719F1272800A1A158 /* QNAsyncRun.m in Sources */,
744775
DFA9B64B19E0018800A15FD1 /* QNUploadOption.m in Sources */,
@@ -758,11 +789,13 @@
758789
DFA9B64119DFDA5F00A15FD1 /* QNEtag.m in Sources */,
759790
DF3C504819DD7BA6000F548F /* QNFormUploadTest.m in Sources */,
760791
DF609A021A5839B400AC7297 /* QNDnsTest.m in Sources */,
792+
DF437CE01B243A2C0099587B /* QNUpTokenTest.m in Sources */,
761793
DF0D23D119DCF02400D6B68F /* QNResponseInfo.m in Sources */,
762794
DFBC622619DE459800458C4B /* QNHttpTest.m in Sources */,
763795
DF0D23CB19DCC5D300D6B68F /* QNHttpManager.m in Sources */,
764796
DFA39AA819F1272800A1A158 /* QNAsyncRun.m in Sources */,
765797
DF0D23CA19DCC5CF00D6B68F /* QNUserAgent.m in Sources */,
798+
DF437CDD1B2429E10099587B /* QNUpToken.m in Sources */,
766799
DF0D23C619DCC57500D6B68F /* QNResumeUpload.m in Sources */,
767800
DF2CDE7419DAF65800CE01FB /* QNUrlSafeBase64.m in Sources */,
768801
DF3C504B19DD7D9F000F548F /* QNResumeUploadTest.m in Sources */,
@@ -772,6 +805,7 @@
772805
DFF5253A1A64079B00D02BA1 /* QNSessionTest.m in Sources */,
773806
DF609A091A58E39D00AC7297 /* QNFormUpload.m in Sources */,
774807
DFF525351A6235D100D02BA1 /* QNSessionManager.m in Sources */,
808+
DF437CD61B2426270099587B /* GTM_Base64.m in Sources */,
775809
DFA9B64019DFD8C900A15FD1 /* QNEtagTest.m in Sources */,
776810
DF6099FF1A5676CA00AC7297 /* QNDns.m in Sources */,
777811
DF2CDE7E19DAF65800CE01FB /* QNUploadManager.m in Sources */,

QiniuSDK/Common/GTM_Base64.h

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
//
2+
// GTMBase64.h
3+
//
4+
// Copyright 2006-2008 Google Inc.
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
7+
// use this file except in compliance with the License. You may obtain a copy
8+
// of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
// License for the specific language governing permissions and limitations under
16+
// the License.
17+
//
18+
19+
#import <Foundation/Foundation.h>
20+
21+
// GTMBase64
22+
//
23+
/// Helper for handling Base64 and WebSafeBase64 encodings
24+
//
25+
/// The webSafe methods use different character set and also the results aren't
26+
/// always padded to a multiple of 4 characters. This is done so the resulting
27+
/// data can be used in urls and url query arguments without needing any
28+
/// encoding. You must use the webSafe* methods together, the data does not
29+
/// interop with the RFC methods.
30+
//
31+
@interface GTM_Base64 : NSObject
32+
33+
//
34+
// Standard Base64 (RFC) handling
35+
//
36+
37+
// encodeData:
38+
//
39+
/// Base64 encodes contents of the NSData object.
40+
//
41+
/// Returns:
42+
/// A new autoreleased NSData with the encoded payload. nil for any error.
43+
//
44+
+ (NSData *)encodeData:(NSData *)data;
45+
46+
// decodeData:
47+
//
48+
/// Base64 decodes contents of the NSData object.
49+
//
50+
/// Returns:
51+
/// A new autoreleased NSData with the decoded payload. nil for any error.
52+
//
53+
+ (NSData *)decodeData:(NSData *)data;
54+
55+
// encodeBytes:length:
56+
//
57+
/// Base64 encodes the data pointed at by |bytes|.
58+
//
59+
/// Returns:
60+
/// A new autoreleased NSData with the encoded payload. nil for any error.
61+
//
62+
+ (NSData *)encodeBytes:(const void *)bytes length:(NSUInteger)length;
63+
64+
// decodeBytes:length:
65+
//
66+
/// Base64 decodes the data pointed at by |bytes|.
67+
//
68+
/// Returns:
69+
/// A new autoreleased NSData with the encoded payload. nil for any error.
70+
//
71+
+ (NSData *)decodeBytes:(const void *)bytes length:(NSUInteger)length;
72+
73+
// stringByEncodingData:
74+
//
75+
/// Base64 encodes contents of the NSData object.
76+
//
77+
/// Returns:
78+
/// A new autoreleased NSString with the encoded payload. nil for any error.
79+
//
80+
+ (NSString *)stringByEncodingData:(NSData *)data;
81+
82+
// stringByEncodingBytes:length:
83+
//
84+
/// Base64 encodes the data pointed at by |bytes|.
85+
//
86+
/// Returns:
87+
/// A new autoreleased NSString with the encoded payload. nil for any error.
88+
//
89+
+ (NSString *)stringByEncodingBytes:(const void *)bytes length:(NSUInteger)length;
90+
91+
// decodeString:
92+
//
93+
/// Base64 decodes contents of the NSString.
94+
//
95+
/// Returns:
96+
/// A new autoreleased NSData with the decoded payload. nil for any error.
97+
//
98+
+ (NSData *)decodeString:(NSString *)string;
99+
100+
//
101+
// Modified Base64 encoding so the results can go onto urls.
102+
//
103+
// The changes are in the characters generated and also allows the result to
104+
// not be padded to a multiple of 4.
105+
// Must use the matching call to encode/decode, won't interop with the
106+
// RFC versions.
107+
//
108+
109+
// webSafeEncodeData:padded:
110+
//
111+
/// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES
112+
/// then padding characters are added so the result length is a multiple of 4.
113+
//
114+
/// Returns:
115+
/// A new autoreleased NSData with the encoded payload. nil for any error.
116+
//
117+
+ (NSData *)webSafeEncodeData:(NSData *)data
118+
padded:(BOOL)padded;
119+
120+
// webSafeDecodeData:
121+
//
122+
/// WebSafe Base64 decodes contents of the NSData object.
123+
//
124+
/// Returns:
125+
/// A new autoreleased NSData with the decoded payload. nil for any error.
126+
//
127+
+ (NSData *)webSafeDecodeData:(NSData *)data;
128+
129+
// webSafeEncodeBytes:length:padded:
130+
//
131+
/// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES
132+
/// then padding characters are added so the result length is a multiple of 4.
133+
//
134+
/// Returns:
135+
/// A new autoreleased NSData with the encoded payload. nil for any error.
136+
//
137+
+ (NSData *)webSafeEncodeBytes:(const void *)bytes
138+
length:(NSUInteger)length
139+
padded:(BOOL)padded;
140+
141+
// webSafeDecodeBytes:length:
142+
//
143+
/// WebSafe Base64 decodes the data pointed at by |bytes|.
144+
//
145+
/// Returns:
146+
/// A new autoreleased NSData with the encoded payload. nil for any error.
147+
//
148+
+ (NSData *)webSafeDecodeBytes:(const void *)bytes length:(NSUInteger)length;
149+
150+
// stringByWebSafeEncodingData:padded:
151+
//
152+
/// WebSafe Base64 encodes contents of the NSData object. If |padded| is YES
153+
/// then padding characters are added so the result length is a multiple of 4.
154+
//
155+
/// Returns:
156+
/// A new autoreleased NSString with the encoded payload. nil for any error.
157+
//
158+
+ (NSString *)stringByWebSafeEncodingData:(NSData *)data
159+
padded:(BOOL)padded;
160+
161+
// stringByWebSafeEncodingBytes:length:padded:
162+
//
163+
/// WebSafe Base64 encodes the data pointed at by |bytes|. If |padded| is YES
164+
/// then padding characters are added so the result length is a multiple of 4.
165+
//
166+
/// Returns:
167+
/// A new autoreleased NSString with the encoded payload. nil for any error.
168+
//
169+
+ (NSString *)stringByWebSafeEncodingBytes:(const void *)bytes
170+
length:(NSUInteger)length
171+
padded:(BOOL)padded;
172+
173+
// webSafeDecodeString:
174+
//
175+
/// WebSafe Base64 decodes contents of the NSString.
176+
//
177+
/// Returns:
178+
/// A new autoreleased NSData with the decoded payload. nil for any error.
179+
//
180+
+ (NSData *)webSafeDecodeString:(NSString *)string;
181+
182+
@end

0 commit comments

Comments
 (0)