I'm making two calls to my server with different p12 certificates. The problem is that on the second call it is using the certificate from the first call even though I assigned it a new certificate.

First call (it downloads the second certificate I want to use for the second call):

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request addRequestHeader:@"Content-Type" value:@"application/x-pkcs12"];
    [request setValidatesSecureCertificate:YES];
    [request setCachePolicy: ASIDoNotWriteToCacheCachePolicy | ASIDoNotReadFromCacheCachePolicy];
    [request setClientCertificateIdentity:[self copyClientCertificate]];
    [request setDownloadDestinationPath:thePath];
    [request setDelegate:self];
    [request setUseCookiePersistence:YES];
    [request startAsynchronous];
    [request setDidReceiveResponseHeadersSelector:@selector(didReceiveResponseHeaders:)];
    [request setDidFinishSelector:@selector(ConnectFinished:)];

On the second call:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
            [request setValidatesSecureCertificate:YES];
            [request setCachePolicy: ASIDoNotWriteToCacheCachePolicy | ASIDoNotReadFromCacheCachePolicy];
            [request setClientCertificateIdentity:[self copyClientCertificate2]];
            [request setCachePolicy:ASIDoNotReadFromCacheCachePolicy];
            [request setDelegate:self];
            [request setUseCookiePersistence:YES];
            [request startAsynchronous];
            [request setDidFinishSelector:@selector(ConnectFinished2:)];

However, I can see in my server that the second call is using the first certificate even though it is getting another certificate on copyClientCertificate2. So is the certificate getting cached? How can I explicitly tell the second ASIHTTPRequest to use the second certificate?

Note: it is 2 different URLS but the same domain.

Thanks!

有帮助吗?

解决方案

If you can, try changing the DNS settings so you will have two different domains. That should solve your cache problems.

其他提示

You have to use this method of Matt Thompson's ASIHTTP unmaintained Library [[ASIDownloadCache sharedCache] removeCachedDataForURL: yourURLReference];

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top