how to handle server nonce during digest authentication

I am using SDWebImage in iOS with http digest authentication. As expected I get 401 Unauthorized error the first time the request is made, but I am not sure how to read WWW-Authenticate response header (and get the nonce/realm etc.) so that I can resend the request with supplied nonce (to prevent replay attacks).

    SDWebImageDownloader *downloader = [SDWebImageManager sharedManager].imageDownloader;
[downloader setValue:email forHTTPHeaderField:@"X-Oauth-Username"];
// set other headers here ...
// QUESTION: no way to get the response headers ??

[SDWebImageDownloader.sharedDownloader downloadImageWithURL:imageUrl options:0
        progress:^(NSInteger receivedSize, NSInteger expectedSize) {
            // progression tracking code
        }
        completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
            callback(encodedUrl, image);
        }
];

Or, SDWebImage doesn't support HTTP Digest Authentication ? If so, are there any alternate framework which can handle this ?

链接地址: http://www.djcxy.com/p/22292.html

上一篇: Android Digest身份验证

下一篇: 如何在摘要身份验证期间处理服务器随机数