我正在为ASIHttpRequest(ASIS3)使用Amazon S3支持库。它提供了高级抽象选择器,用于与S3存储库交互。
默认情况下,它使用的是使用标准HTTP的URL,但我想启用HTTPS。
有谁知道怎么做?
谢谢!
答案 0 :(得分:1)
ASIS3Request类中有一个名为requestScheme的属性。它的默认值是ASIS3RequestSchemeHTTP,将其更改为ASIS3RequestSchemeHTTPS,所有S3调用都将使用HTTPS。
以下是ASIS3Request的初始化选择器,将requestScheme更改为使用HTTPS。
- (id)initWithURL:(NSURL *)newURL
{
self = [super initWithURL:newURL];
// After a bit of experimentation/guesswork, this number seems to reduce the chance of a 'RequestTimeout' error
[self setPersistentConnectionTimeoutSeconds:20];
[self setRequestScheme:ASIS3RequestSchemeHTTPS];
return self;
}