santactl/sync: When rejecting a redirect, cancel the task to avoid hanging the task until timeout

This commit is contained in:
Russell Hancox
2015-06-24 17:32:35 -04:00
parent f4c94ab1d7
commit f625016efe

View File

@@ -112,6 +112,8 @@
newRequest:(NSURLRequest *)request
completionHandler:(void (^)(NSURLRequest *))completionHandler {
if (self.refusesRedirects) {
LOGD(@"Rejected redirection to: %@", request.URL);
[task cancel]; // without this, the connection hangs until timeout!?!
completionHandler(NULL);
} else {
completionHandler(request);