Showing
3 changed files
with
15 additions
and
1 deletions
| @@ -195,6 +195,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -195,6 +195,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 195 | // HTTP status code, eg: 200 = OK, 404 = Not found etc | 195 | // HTTP status code, eg: 200 = OK, 404 = Not found etc |
| 196 | int responseStatusCode; | 196 | int responseStatusCode; |
| 197 | 197 | ||
| 198 | + NSString *responseStatusMessage; | ||
| 199 | + | ||
| 198 | // Size of the response | 200 | // Size of the response |
| 199 | unsigned long long contentLength; | 201 | unsigned long long contentLength; |
| 200 | 202 | ||
| @@ -540,6 +542,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -540,6 +542,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 540 | @property (retain) NSDictionary *requestCredentials; | 542 | @property (retain) NSDictionary *requestCredentials; |
| 541 | @property (retain) NSDictionary *proxyCredentials; | 543 | @property (retain) NSDictionary *proxyCredentials; |
| 542 | @property (assign,readonly) int responseStatusCode; | 544 | @property (assign,readonly) int responseStatusCode; |
| 545 | +@property (retain,readonly) NSString *responseStatusMessage; | ||
| 543 | @property (retain,readonly) NSMutableData *rawResponseData; | 546 | @property (retain,readonly) NSMutableData *rawResponseData; |
| 544 | @property (assign) NSTimeInterval timeOutSeconds; | 547 | @property (assign) NSTimeInterval timeOutSeconds; |
| 545 | @property (retain) NSString *requestMethod; | 548 | @property (retain) NSString *requestMethod; |
| @@ -124,7 +124,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | @@ -124,7 +124,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | ||
| 124 | @property (retain) NSConditionLock *authenticationLock; | 124 | @property (retain) NSConditionLock *authenticationLock; |
| 125 | @property (retain) NSString *authenticationRealm; | 125 | @property (retain) NSString *authenticationRealm; |
| 126 | @property (retain) NSString *proxyAuthenticationRealm; | 126 | @property (retain) NSString *proxyAuthenticationRealm; |
| 127 | - | 127 | +@property (retain) NSString *responseStatusMessage; |
| 128 | @end | 128 | @end |
| 129 | 129 | ||
| 130 | 130 | ||
| @@ -1158,6 +1158,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | @@ -1158,6 +1158,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | ||
| 1158 | 1158 | ||
| 1159 | CFRelease(headerFields); | 1159 | CFRelease(headerFields); |
| 1160 | [self setResponseStatusCode:CFHTTPMessageGetResponseStatusCode(headers)]; | 1160 | [self setResponseStatusCode:CFHTTPMessageGetResponseStatusCode(headers)]; |
| 1161 | + [self setResponseStatusMessage:[(NSString *)CFHTTPMessageCopyResponseStatusLine(headers) autorelease]]; | ||
| 1161 | 1162 | ||
| 1162 | // Is the server response a challenge for credentials? | 1163 | // Is the server response a challenge for credentials? |
| 1163 | isAuthenticationChallenge = ([self responseStatusCode] == 401); | 1164 | isAuthenticationChallenge = ([self responseStatusCode] == 401); |
| @@ -1248,6 +1249,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | @@ -1248,6 +1249,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | ||
| 1248 | return isAuthenticationChallenge; | 1249 | return isAuthenticationChallenge; |
| 1249 | } | 1250 | } |
| 1250 | 1251 | ||
| 1252 | + | ||
| 1251 | #pragma mark http authentication | 1253 | #pragma mark http authentication |
| 1252 | 1254 | ||
| 1253 | - (void)saveProxyCredentialsToKeychain:(NSMutableDictionary *)newCredentials | 1255 | - (void)saveProxyCredentialsToKeychain:(NSMutableDictionary *)newCredentials |
| @@ -2814,6 +2816,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | @@ -2814,6 +2816,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | ||
| 2814 | @synthesize shouldPresentAuthenticationDialog; | 2816 | @synthesize shouldPresentAuthenticationDialog; |
| 2815 | @synthesize shouldPresentProxyAuthenticationDialog; | 2817 | @synthesize shouldPresentProxyAuthenticationDialog; |
| 2816 | @synthesize authenticationChallengeInProgress; | 2818 | @synthesize authenticationChallengeInProgress; |
| 2819 | +@synthesize responseStatusMessage; | ||
| 2817 | @end | 2820 | @end |
| 2818 | 2821 | ||
| 2819 | 2822 |
| @@ -890,6 +890,14 @@ | @@ -890,6 +890,14 @@ | ||
| 890 | GHAssertNotNil([request error],@"Failed to generate an authentication when attempting to write to an invalid location"); | 890 | GHAssertNotNil([request error],@"Failed to generate an authentication when attempting to write to an invalid location"); |
| 891 | } | 891 | } |
| 892 | 892 | ||
| 893 | +- (void)testResponseStatusMessage | ||
| 894 | +{ | ||
| 895 | + ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/the-meaning-of-life"]]; | ||
| 896 | + [request start]; | ||
| 897 | + BOOL success = [[request responseStatusMessage] isEqualToString:@"HTTP/1.0 404 Not Found"]; | ||
| 898 | + GHAssertTrue(success,@"Got wrong response status message"); | ||
| 899 | +} | ||
| 900 | + | ||
| 893 | @end | 901 | @end |
| 894 | 902 | ||
| 895 | 903 |
-
Please register or login to post a comment