Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Status Code Overwrite Fix #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Classes/ASIHTTPRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ typedef void (^ASIDataBlock)(NSData *data);
// HTTP status code, eg: 200 = OK, 404 = Not found etc
int responseStatusCode;

// HTTP status code, eg: 200 = OK, 404 = Not found etc.
// This does NOT change unlike responseStatusCode when cached headers are pulled from disk.
int uncachedResponseStatusCode;

// Description of the HTTP status code
NSString *responseStatusMessage;

Expand Down Expand Up @@ -943,6 +947,7 @@ typedef void (^ASIDataBlock)(NSData *data);
@property (retain) NSDictionary *requestCredentials;
@property (retain) NSDictionary *proxyCredentials;
@property (assign,readonly) int responseStatusCode;
@property (assign,readonly) int uncachedResponseStatusCode;
@property (retain,readonly) NSString *responseStatusMessage;
@property (retain) NSMutableData *rawResponseData;
@property (assign) NSTimeInterval timeOutSeconds;
Expand Down
3 changes: 3 additions & 0 deletions Classes/ASIHTTPRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ - (void)callBlock:(ASIBasicBlock)block;
@property (assign) BOOL complete;
@property (retain) NSArray *responseCookies;
@property (assign) int responseStatusCode;
@property (assign) int uncachedResponseStatusCode;
@property (retain, nonatomic) NSDate *lastActivityTime;

@property (assign) unsigned long long partialDownloadSize;
Expand Down Expand Up @@ -2154,6 +2155,7 @@ - (void)readResponseHeaders

[self setResponseHeaders:[NSMakeCollectable(CFHTTPMessageCopyAllHeaderFields(message)) autorelease]];
[self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)];
[self setUncachedResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)];
[self setResponseStatusMessage:[NSMakeCollectable(CFHTTPMessageCopyResponseStatusLine(message)) autorelease]];

if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) {
Expand Down Expand Up @@ -5032,6 +5034,7 @@ - (void)setRequestRedirectedBlock:(ASIBasicBlock)aRedirectBlock
@synthesize requestCookies;
@synthesize requestCredentials;
@synthesize responseStatusCode;
@synthesize uncachedResponseStatusCode;
@synthesize rawResponseData;
@synthesize lastActivityTime;
@synthesize timeOutSeconds;
Expand Down