Skip to content

Commit 2f60b69

Browse files
author
erichmzhang
committed
5.3.3 修复了某些头部在签名里签了会导致的问题
1 parent 550e8b2 commit 2f60b69

File tree

8 files changed

+53
-22
lines changed

8 files changed

+53
-22
lines changed

CHANGELOG.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 5.3.2
2+
- 修复了签名时取到的某些头部可能会变更的问题
3+
14
# 5.3.0
25
- 增加了生成预签名 URL 的接口。
36
- 增加列出指定前缀 Object 所有版本的接口。
@@ -8,25 +11,25 @@
811
- 针对弱网络情况进行优化,大幅度提高弱网络情况下上传成功率。
912
- 修复分块 Copy 大文件的问题。
1013
- 签名计算时支持自定义开始和结束时间。
11-
12-
14+
1315
# 5.2.0
1416
- 增加了精简版的SDK,只支持上传下载功能。
1517
- BucketName概念统一。
1618
- 支持查看Response中原始的HTTP Response内容。
1719
- 其它一些BUG修复与性能优化。
18-
20+
1921
# 5.1.3
2022
- BucketName概念统一。
21-
23+
2224
# 5.1.2
2325
- 修复C++混编情况下的问题
24-
26+
2527
# 5.1.1
2628
- 修复了一些问题
27-
29+
2830
# 5.1.0
2931
- 增加了LifeCycle相关接口。
3032
- 增加了Copy Object的接口。
3133
- 分块上传初始化时,返回resumeData,方便异常情况中断后的续传。
3234
- 其它一些优化。
35+

QCloudCOSXML.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QCloudCOSXML"
3-
s.version = "5.3.2"
3+
s.version = "5.3.3"
44
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
55

66
s.homepage = "https://cloud.tencent.com/"
@@ -9,10 +9,10 @@ Pod::Spec.new do |s|
99
s.source = { :git => "https://github.com/tencentyun/qcloud-sdk-ios.git", :tag => s.version.to_s }
1010
s.ios.deployment_target = '8.0'
1111
s.source_files = 'QCloudCOSXML/Classes/**/*'
12-
s.dependency "QCloudCore",'5.3.2'
12+
s.dependency "QCloudCore",'5.3.3'
1313

1414
s.subspec 'Transfer' do |sbt|
1515
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/*','QCloudCOSXML/Classes/Base/*'
16-
sbt.dependency "QCloudCore",'5.3.2'
16+
sbt.dependency "QCloudCore",'5.3.3'
1717
end
1818
end

QCloudCOSXML/Classes/QCloudCOSXMLVersion.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
#ifndef QCloudCOSXMLModuleVersion_h
88
#define QCloudCOSXMLModuleVersion_h
9-
#define QCloudCOSXMLModuleVersionNumber 503002
9+
#define QCloudCOSXMLModuleVersionNumber 503003
1010

1111
//dependency
12-
#if QCloudCoreModuleVersionNumber != 503002
13-
#error "库QCloudCOSXML依赖QCloudCore最小版本号为5.3.2,当前引入的QCloudCore版本号过低,请及时升级后使用"
12+
#if QCloudCoreModuleVersionNumber != 503003
13+
#error "库QCloudCOSXML依赖QCloudCore最小版本号为5.3.3,当前引入的QCloudCore版本号过低,请及时升级后使用"
1414
#endif
1515

1616
//
1717
FOUNDATION_EXTERN NSString * const QCloudCOSXMLModuleVersion;
1818
FOUNDATION_EXTERN NSString * const QCloudCOSXMLModuleName;
1919

20-
#endif
20+
#endif

QCloudCOSXML/Classes/QCloudCOSXMLVersion.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import "QCloudCOSXMLVersion.h"
2-
NSString * const QCloudCOSXMLModuleVersion = @"5.3.2";
2+
NSString * const QCloudCOSXMLModuleVersion = @"5.3.3";
33
NSString * const QCloudCOSXMLModuleName = @"QCloudCOSXML";
44
@interface QCloudQCloudCOSXMLLoad : NSObject
55
@end
@@ -26,4 +26,4 @@ + (void) load
2626
#pragma clang diagnostic pop
2727
}
2828
}
29-
@end
29+
@end

QCloudCore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = "QCloudCore"
11-
s.version = "5.3.2"
11+
s.version = "5.3.3"
1212
s.summary = "QCloudCore--腾讯云iOS-SDK Foundation"
1313

1414
# This description is used to generate tags and improve search results.

QCloudCore/Classes/QCloudClientBase/Authentation/QCloudAuthentationV5Creator.m

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@
1515
#import "NSString+QCloudSHA.h"
1616
#import <CommonCrypto/CommonDigest.h>
1717
#import "QCloudLogger.h"
18+
19+
@implementation NSDictionary(HeaderFilter)
20+
- (NSDictionary*)filteHeaders; {
21+
NSMutableDictionary* signedHeaders = [[NSMutableDictionary alloc] init];
22+
__block const NSArray* shouldSignedHeaderList = @[ @"Content-Length", @"Content-MD5",@"Host"];
23+
[self enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
24+
//签名的Headers列表:x开头的(x-cos-之类的),host,content-length,content-MD5
25+
BOOL shouldSigned = NO;
26+
for (NSString* header in shouldSignedHeaderList) {
27+
if ([header isEqualToString:((NSString*)key)]) {
28+
shouldSigned = YES;
29+
}
30+
}
31+
NSArray* headerSeperatedArray = [key componentsSeparatedByString:@"-"];
32+
if ([headerSeperatedArray firstObject] && [headerSeperatedArray.firstObject isEqualToString:@"x"]) {
33+
shouldSigned = YES;
34+
}
35+
if (shouldSigned) {
36+
signedHeaders[key]=obj;
37+
}
38+
}];
39+
return [signedHeaders copy];
40+
}
41+
@end
42+
43+
44+
1845
@implementation QCloudAuthentationV5Creator
1946

2047
- (QCloudSignature*) signatureForData:(NSMutableURLRequest *)urlrequest
@@ -35,8 +62,7 @@ - (QCloudSignature*) signatureForData:(NSMutableURLRequest *)urlrequest
3562
}
3663
NSString * signTime = [NSString stringWithFormat:@"%lld;%lld",(int64_t)nowInterval, (int64_t)experationInterVal];
3764
//
38-
NSDictionary* headers = [urlrequest allHTTPHeaderFields];
39-
65+
NSDictionary* headers = [[urlrequest allHTTPHeaderFields] filteHeaders];
4066
NSDictionary* urlParamters = QCloudURLReadQuery(urlrequest.URL);
4167
NSDictionary* (^LowcaseDictionary)(NSDictionary* origin) = ^(NSDictionary* origin) {
4268
NSMutableDictionary* aim = [NSMutableDictionary new];
@@ -114,4 +140,6 @@ - (QCloudSignature*) signatureForData:(NSMutableURLRequest *)urlrequest
114140
QCloudLogDebug(@"authoration is %@", authoration);
115141
return [QCloudSignature signatureWith1Day:authoration];
116142
}
143+
144+
117145
@end

QCloudCore/Classes/QCloudCoreVersion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
#ifndef QCloudCoreModuleVersion_h
77
#define QCloudCoreModuleVersion_h
8-
#define QCloudCoreModuleVersionNumber 503002
8+
#define QCloudCoreModuleVersionNumber 503003
99

1010
//dependency
1111

1212
//
1313
FOUNDATION_EXTERN NSString * const QCloudCoreModuleVersion;
1414
FOUNDATION_EXTERN NSString * const QCloudCoreModuleName;
1515

16-
#endif
16+
#endif

QCloudCore/Classes/QCloudCoreVersion.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import "QCloudCoreVersion.h"
2-
NSString * const QCloudCoreModuleVersion = @"5.3.2";
2+
NSString * const QCloudCoreModuleVersion = @"5.3.3";
33
NSString * const QCloudCoreModuleName = @"QCloudCore";
44
@interface QCloudQCloudCoreLoad : NSObject
55
@end
@@ -26,4 +26,4 @@ + (void) load
2626
#pragma clang diagnostic pop
2727
}
2828
}
29-
@end
29+
@end

0 commit comments

Comments
 (0)