Ben Copsey

Added responseStatusMessage

... ... @@ -195,6 +195,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// HTTP status code, eg: 200 = OK, 404 = Not found etc
int responseStatusCode;
NSString *responseStatusMessage;
// Size of the response
unsigned long long contentLength;
... ... @@ -540,6 +542,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
@property (retain) NSDictionary *requestCredentials;
@property (retain) NSDictionary *proxyCredentials;
@property (assign,readonly) int responseStatusCode;
@property (retain,readonly) NSString *responseStatusMessage;
@property (retain,readonly) NSMutableData *rawResponseData;
@property (assign) NSTimeInterval timeOutSeconds;
@property (retain) NSString *requestMethod;
... ...
... ... @@ -124,7 +124,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil;
@property (retain) NSConditionLock *authenticationLock;
@property (retain) NSString *authenticationRealm;
@property (retain) NSString *proxyAuthenticationRealm;
@property (retain) NSString *responseStatusMessage;
@end
... ... @@ -1158,6 +1158,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil;
CFRelease(headerFields);
[self setResponseStatusCode:CFHTTPMessageGetResponseStatusCode(headers)];
[self setResponseStatusMessage:[(NSString *)CFHTTPMessageCopyResponseStatusLine(headers) autorelease]];
// Is the server response a challenge for credentials?
isAuthenticationChallenge = ([self responseStatusCode] == 401);
... ... @@ -1248,6 +1249,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil;
return isAuthenticationChallenge;
}
#pragma mark http authentication
- (void)saveProxyCredentialsToKeychain:(NSMutableDictionary *)newCredentials
... ... @@ -2814,6 +2816,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil;
@synthesize shouldPresentAuthenticationDialog;
@synthesize shouldPresentProxyAuthenticationDialog;
@synthesize authenticationChallengeInProgress;
@synthesize responseStatusMessage;
@end
... ...
... ... @@ -890,6 +890,14 @@
GHAssertNotNil([request error],@"Failed to generate an authentication when attempting to write to an invalid location");
}
- (void)testResponseStatusMessage
{
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/the-meaning-of-life"]];
[request start];
BOOL success = [[request responseStatusMessage] isEqualToString:@"HTTP/1.0 404 Not Found"];
GHAssertTrue(success,@"Got wrong response status message");
}
@end
... ...