Question

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!

Était-ce utile?

La solution

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

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top