Domanda

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!

È stato utile?

Soluzione

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

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top