Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
[Issue #719] Adding shouldUseCredentialStorage property to AFURLConne…
Browse files Browse the repository at this point in the history
…ctionOperation /thanks Xihe Yu
  • Loading branch information
mattt committed Jan 7, 2013
1 parent 1e7c45c commit 9aeb386
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 10 additions & 3 deletions AFNetworking/AFURLConnectionOperation.h
Expand Up @@ -126,9 +126,16 @@
@property (readonly, nonatomic, assign) NSStringEncoding responseStringEncoding;


///--------------------------------
/// @name Accessing URL Credentials
///--------------------------------
///-------------------------------
/// @name Managing URL Credentials
///-------------------------------

/**
Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default.
@discussion This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`.
*/
@property (nonatomic, assign) BOOL shouldUseCredentialStorage;

/**
The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.
Expand Down
7 changes: 7 additions & 0 deletions AFNetworking/AFURLConnectionOperation.m
Expand Up @@ -145,6 +145,7 @@ @implementation AFURLConnectionOperation
@dynamic inputStream;
@synthesize outputStream = _outputStream;
@synthesize credential = _credential;
@synthesize shouldUseCredentialStorage = _shouldUseCredentialStorage;
@synthesize userInfo = _userInfo;
@synthesize backgroundTaskIdentifier = _backgroundTaskIdentifier;
@synthesize uploadProgress = _uploadProgress;
Expand Down Expand Up @@ -205,6 +206,8 @@ - (id)initWithRequest:(NSURLRequest *)urlRequest {
self.runLoopModes = [NSSet setWithObject:NSRunLoopCommonModes];

self.request = urlRequest;

self.shouldUseCredentialStorage = YES;

self.outputStream = [NSOutputStream outputStreamToMemory];

Expand Down Expand Up @@ -573,6 +576,10 @@ - (void)connection:(NSURLConnection *)connection
}
}

- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection __unused *)connection {
return self.shouldUseCredentialStorage;
}

- (NSInputStream *)connection:(NSURLConnection __unused *)connection
needNewBodyStream:(NSURLRequest *)request
{
Expand Down

0 comments on commit 9aeb386

Please sign in to comment.