I am trying to switch from http to https for some server API calls right now and I am having a problem with it that I cannot explain to myself.
Right after switching from http to https I am experiencing that my async request takes the full 60 seconds to finish, despite the fact that the server has already handled the request.
There is no error being thrown, no timeout occurring or anything like that, it just seems to take the full 60 seconds to notice that the request is finished. And then, after 60 seconds, it does just what it's meant to do.
This is what I am doing:
NSString *theBody = @"param1=value1¶m2=value2";
NSData *bodyData = [theBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSURL *url = [NSURL URLWithString:@"https://my.api.server.com/call"];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
[request setValue:@"My User-Agent" forHTTPHeaderField:@"User-Agent"];
// Tested this one, too. Yes, I did set to utf8 encoding when trying this
// [request setValue:@"application/x-www-form-urlencoded charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:bodyData];
// testing only
// [request setTimeoutInterval:15];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSLog(@"Finished!");
}];
The log message is thrown after 60 seconds. When refreshing the corresponding data before the log message is put out, I can see that everything's already happened - I can pull the refreshed data correctly.
I already thought it was my server taking so long for answering, but I have tried the same request using Ruby as a quick test run and it worked correctly.
Does anyone know what could be happening here?
Thanks in advance
Arne