2011-10-06 58 views
0

我正在使用ASIHttpRequest(ASIS3)的Amazon S3支持庫。它提供高級抽象選擇器來與S3存儲庫進行交互。啓用HTTPS與ASIS3

默認情況下,它使用的是使用標準HTTP的URL,但我想啓用HTTPS。

有誰知道如何做到這一點?

謝謝!

回答

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; 
}