Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2009-09-13 13:50:32 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e98fd1e4119e23ddb70fb4d5cb1ea2aa83219b78
e98fd1e4
1 parent
be69495c
Added responseStatusMessage
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
Classes/ASIHTTPRequest.h
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.h
View file @
e98fd1e
...
...
@@ -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
;
...
...
Classes/ASIHTTPRequest.m
View file @
e98fd1e
...
...
@@ -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
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
e98fd1e
...
...
@@ -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
...
...
Please
register
or
login
to post a comment