Skip to content

Commit

Permalink
5.3.3 修复了某些头部在签名里签了会导致的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
erichmzhang committed Mar 23, 2018
1 parent 550e8b2 commit 2f60b69
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 22 deletions.
15 changes: 9 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 5.3.2
- 修复了签名时取到的某些头部可能会变更的问题

# 5.3.0
- 增加了生成预签名 URL 的接口。
- 增加列出指定前缀 Object 所有版本的接口。
Expand All @@ -8,25 +11,25 @@
- 针对弱网络情况进行优化,大幅度提高弱网络情况下上传成功率。
- 修复分块 Copy 大文件的问题。
- 签名计算时支持自定义开始和结束时间。



# 5.2.0
- 增加了精简版的SDK,只支持上传下载功能。
- BucketName概念统一。
- 支持查看Response中原始的HTTP Response内容。
- 其它一些BUG修复与性能优化。

# 5.1.3
- BucketName概念统一。

# 5.1.2
- 修复C++混编情况下的问题

# 5.1.1
- 修复了一些问题

# 5.1.0
- 增加了LifeCycle相关接口。
- 增加了Copy Object的接口。
- 分块上传初始化时,返回resumeData,方便异常情况中断后的续传。
- 其它一些优化。

6 changes: 3 additions & 3 deletions QCloudCOSXML.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "QCloudCOSXML"
s.version = "5.3.2"
s.version = "5.3.3"
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"

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

s.subspec 'Transfer' do |sbt|
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/*','QCloudCOSXML/Classes/Base/*'
sbt.dependency "QCloudCore",'5.3.2'
sbt.dependency "QCloudCore",'5.3.3'
end
end
8 changes: 4 additions & 4 deletions QCloudCOSXML/Classes/QCloudCOSXMLVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

#ifndef QCloudCOSXMLModuleVersion_h
#define QCloudCOSXMLModuleVersion_h
#define QCloudCOSXMLModuleVersionNumber 503002
#define QCloudCOSXMLModuleVersionNumber 503003

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

//
FOUNDATION_EXTERN NSString * const QCloudCOSXMLModuleVersion;
FOUNDATION_EXTERN NSString * const QCloudCOSXMLModuleName;

#endif
#endif
4 changes: 2 additions & 2 deletions QCloudCOSXML/Classes/QCloudCOSXMLVersion.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "QCloudCOSXMLVersion.h"
NSString * const QCloudCOSXMLModuleVersion = @"5.3.2";
NSString * const QCloudCOSXMLModuleVersion = @"5.3.3";
NSString * const QCloudCOSXMLModuleName = @"QCloudCOSXML";
@interface QCloudQCloudCOSXMLLoad : NSObject
@end
Expand All @@ -26,4 +26,4 @@ + (void) load
#pragma clang diagnostic pop
}
}
@end
@end
2 changes: 1 addition & 1 deletion QCloudCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "QCloudCore"
s.version = "5.3.2"
s.version = "5.3.3"
s.summary = "QCloudCore--腾讯云iOS-SDK Foundation"

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,33 @@
#import "NSString+QCloudSHA.h"
#import <CommonCrypto/CommonDigest.h>
#import "QCloudLogger.h"

@implementation NSDictionary(HeaderFilter)
- (NSDictionary*)filteHeaders; {
NSMutableDictionary* signedHeaders = [[NSMutableDictionary alloc] init];
__block const NSArray* shouldSignedHeaderList = @[ @"Content-Length", @"Content-MD5",@"Host"];
[self enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
//签名的Headers列表:x开头的(x-cos-之类的),host,content-length,content-MD5
BOOL shouldSigned = NO;
for (NSString* header in shouldSignedHeaderList) {
if ([header isEqualToString:((NSString*)key)]) {
shouldSigned = YES;
}
}
NSArray* headerSeperatedArray = [key componentsSeparatedByString:@"-"];
if ([headerSeperatedArray firstObject] && [headerSeperatedArray.firstObject isEqualToString:@"x"]) {
shouldSigned = YES;
}
if (shouldSigned) {
signedHeaders[key]=obj;
}
}];
return [signedHeaders copy];
}
@end



@implementation QCloudAuthentationV5Creator

- (QCloudSignature*) signatureForData:(NSMutableURLRequest *)urlrequest
Expand All @@ -35,8 +62,7 @@ - (QCloudSignature*) signatureForData:(NSMutableURLRequest *)urlrequest
}
NSString * signTime = [NSString stringWithFormat:@"%lld;%lld",(int64_t)nowInterval, (int64_t)experationInterVal];
//
NSDictionary* headers = [urlrequest allHTTPHeaderFields];

NSDictionary* headers = [[urlrequest allHTTPHeaderFields] filteHeaders];
NSDictionary* urlParamters = QCloudURLReadQuery(urlrequest.URL);
NSDictionary* (^LowcaseDictionary)(NSDictionary* origin) = ^(NSDictionary* origin) {
NSMutableDictionary* aim = [NSMutableDictionary new];
Expand Down Expand Up @@ -114,4 +140,6 @@ - (QCloudSignature*) signatureForData:(NSMutableURLRequest *)urlrequest
QCloudLogDebug(@"authoration is %@", authoration);
return [QCloudSignature signatureWith1Day:authoration];
}


@end
4 changes: 2 additions & 2 deletions QCloudCore/Classes/QCloudCoreVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

#ifndef QCloudCoreModuleVersion_h
#define QCloudCoreModuleVersion_h
#define QCloudCoreModuleVersionNumber 503002
#define QCloudCoreModuleVersionNumber 503003

//dependency

//
FOUNDATION_EXTERN NSString * const QCloudCoreModuleVersion;
FOUNDATION_EXTERN NSString * const QCloudCoreModuleName;

#endif
#endif
4 changes: 2 additions & 2 deletions QCloudCore/Classes/QCloudCoreVersion.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "QCloudCoreVersion.h"
NSString * const QCloudCoreModuleVersion = @"5.3.2";
NSString * const QCloudCoreModuleVersion = @"5.3.3";
NSString * const QCloudCoreModuleName = @"QCloudCore";
@interface QCloudQCloudCoreLoad : NSObject
@end
Expand All @@ -26,4 +26,4 @@ + (void) load
#pragma clang diagnostic pop
}
}
@end
@end

0 comments on commit 2f60b69

Please sign in to comment.