MugunthKumar/MKNetworkKit — Issue #37: HTTP Digest Authentication: providing wrong username&pw => endless loop op:connection:willSendRequestForAuthenticationChallenge
Author: teeqemm
Created: 2012-01-21 08:19:58+00:00
State: open

Hello, if you provide a combination of wrong username and/or wrong password to a MKNetworkOperation, i.e.

MKNetworkOperation *op = [self operationWithURLString:@"http://someurl/"
params:nil
httpMethod:@"GET"];
[op setUsername:@"wrong" password:@"also wrong"];

you will achieve and endless loop between the NSURLConnectionDelegate method connection:willSendRequestForAuthenticationChallenge: providing those wrong credentials and the server faithfull responding with http error 401 credential challenge, triggering the delegate method again. Probably you should introduce some authenticationRetryCount, increase it in connection:willSendRequestForAuthenticationChallenge: and make the MKNetworkOperation fail if authenticationRetryCount reaches 2.

Cheers,
Thomas