Skip to content

Commit

Permalink
save the original url
Browse files Browse the repository at this point in the history
  • Loading branch information
ettore committed Nov 26, 2012
1 parent e5be066 commit 44e1128
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CLFoundation/CLAsyncDownloader.h
Expand Up @@ -63,6 +63,7 @@
int mRequestType;
BOOL mEnableLoadingMsg;
NSURLConnection *mConn;
NSString *mURLString;
}

@property(nonatomic) int requestType;
Expand Down Expand Up @@ -102,6 +103,8 @@
// -----------------------------------------------------------------------------
#pragma mark * Utils *

-(NSString*)currentURL;

// returns the downloaded data
- (NSData *)downloadedData;

Expand Down
13 changes: 12 additions & 1 deletion CLFoundation/CLAsyncDownloader.m
Expand Up @@ -81,6 +81,12 @@ - (id)initWithDelegate:(id<CLDownloaderDelegate>)deleg
}


-(NSString*)currentURL
{
return mURLString;
}


////////////////////////////////////////////////////////////////////////////////
#pragma mark - HTTP API

Expand All @@ -101,6 +107,8 @@ - (CL_ERROR)GET:(NSString*)url_str
if (mEnableLoadingMsg)
[mDelegate showLoadingView:YES];

CLCG_REL(mURLString);
mURLString = [url_str retain];
req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url_str]];
NSString * const content_type = @"application/x-www-form-urlencoded";
[req setValue:content_type forHTTPHeaderField:@"Content-Type"];
Expand Down Expand Up @@ -155,7 +163,10 @@ -(CL_ERROR)doHTTP:(NSString*)method resource:(NSString*)url params:(NSString*)pa
if (mBusy)
return CL_BUSY;
mBusy = YES;


CLCG_REL(mURLString);
mURLString = [url retain];

if (mEnableLoadingMsg)
[mDelegate showLoadingView:YES];

Expand Down

0 comments on commit 44e1128

Please sign in to comment.