From a4b75b01326fc0a31190c74e97584141c09cbf29 Mon Sep 17 00:00:00 2001 From: Thomas Balthazar Date: Thu, 7 May 2009 23:38:30 +0200 Subject: [PATCH] CPURLConnection calls didFailWithError instead of didReceiveResponse for successful HTTP responses other than 200 --- Foundation/CPURLConnection.j | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Foundation/CPURLConnection.j b/Foundation/CPURLConnection.j index 8248cd191..2eeed925c 100644 --- a/Foundation/CPURLConnection.j +++ b/Foundation/CPURLConnection.j @@ -251,15 +251,13 @@ var CPURLConnectionDelegate = nil; if (!_isCanceled) { - if (statusCode == 200 || (statusCode === 0 && _isLocalFileConnection)) + if (statusCode == 401 && [CPURLConnectionDelegate respondsToSelector:@selector(connectionDidReceiveAuthenticationChallenge:)]) + [CPURLConnectionDelegate connectionDidReceiveAuthenticationChallenge:self]; + else { [_delegate connection:self didReceiveData:_XMLHTTPRequest.responseText]; [_delegate connectionDidFinishLoading:self]; } - else if (statusCode == 401 && [CPURLConnectionDelegate respondsToSelector:@selector(connectionDidReceiveAuthenticationChallenge:)]) - [CPURLConnectionDelegate connectionDidReceiveAuthenticationChallenge:self]; - else - [_delegate connection:self didFailWithError:_XMLHTTPRequest.status] } }