开发者

Enable HTTPS wth ASIS3

I am开发者_运维问答 using the Amazon S3 support library for ASIHttpRequest (ASIS3). It provides high level abstracted selectors for interacting with S3 repositories.

By default it is using URLs using standard HTTP, but I'd like to enable HTTPS.

Does anyone know how to do this?

Thanks!


There is a property in the base ASIS3Request class called requestScheme. It's default value is ASIS3RequestSchemeHTTP, change it to ASIS3RequestSchemeHTTPS and all S3 calls will use HTTPS.

Here is the initialization selector for ASIS3Request, changing requestScheme to use 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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜