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-10-14 14:07:30 +0100
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
011111e3365e083b0e5325c03be152257bee6535
011111e3
2 parents
4dd54fbe
257eec53
Merge branch 'master' into authheader
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.h
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.m
View file @
011111e
...
...
@@ -2293,15 +2293,19 @@ static BOOL isiPhoneOS2;
+
(
void
)
removeCredentialsForHost
:
(
NSString
*
)
host
port
:
(
int
)
port
protocol
:
(
NSString
*
)
protocol
realm
:
(
NSString
*
)
realm
{
NSURLProtectionSpace
*
protectionSpace
=
[[[
NSURLProtectionSpace
alloc
]
initWithHost
:
host
port
:
port
protocol
:
protocol
realm
:
realm
authenticationMethod
:
NSURLAuthenticationMethodDefault
]
autorelease
];
NSURLCredentialStorage
*
storage
=
[
NSURLCredentialStorage
sharedCredentialStorage
];
[
storage
removeCredential
:[
storage
defaultCredentialForProtectionSpace
:
protectionSpace
]
forProtectionSpace
:
protectionSpace
];
NSURLCredential
*
credential
=
[[
NSURLCredentialStorage
sharedCredentialStorage
]
defaultCredentialForProtectionSpace
:
protectionSpace
];
if
(
credential
)
{
[[
NSURLCredentialStorage
sharedCredentialStorage
]
removeCredential
:
credential
forProtectionSpace
:
protectionSpace
];
}
}
+
(
void
)
removeCredentialsForProxy
:
(
NSString
*
)
host
port
:
(
int
)
port
realm
:
(
NSString
*
)
realm
{
NSURLProtectionSpace
*
protectionSpace
=
[[[
NSURLProtectionSpace
alloc
]
initWithProxyHost
:
host
port
:
port
type
:
NSURLProtectionSpaceHTTPProxy
realm
:
realm
authenticationMethod
:
NSURLAuthenticationMethodDefault
]
autorelease
];
NSURLCredentialStorage
*
storage
=
[
NSURLCredentialStorage
sharedCredentialStorage
];
[
storage
removeCredential
:[
storage
defaultCredentialForProtectionSpace
:
protectionSpace
]
forProtectionSpace
:
protectionSpace
];
NSURLCredential
*
credential
=
[[
NSURLCredentialStorage
sharedCredentialStorage
]
defaultCredentialForProtectionSpace
:
protectionSpace
];
if
(
credential
)
{
[[
NSURLCredentialStorage
sharedCredentialStorage
]
removeCredential
:
credential
forProtectionSpace
:
protectionSpace
];
}
}
...
...
Classes/Tests/ASIHTTPRequestTests.h
View file @
011111e
...
...
@@ -23,6 +23,7 @@
-
(
void
)
testDownloadProgress
;
-
(
void
)
testUploadProgress
;
-
(
void
)
testCookies
;
-
(
void
)
testRemoveCredentialsFromKeychain
;
-
(
void
)
testBasicAuthentication
;
-
(
void
)
testDigestAuthentication
;
-
(
void
)
testNTLMHandshake
;
...
...
@@ -40,4 +41,5 @@
-
(
void
)
testThrottlingDownloadBandwidth
;
-
(
void
)
testThrottlingUploadBandwidth
;
-
(
void
)
testMainThreadDelegateAuthenticationFailure
;
@end
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
011111e
...
...
@@ -461,6 +461,14 @@
GHAssertTrue
(
success
,
@"Cookie presented to the server when it should have been removed"
);
}
// Test fix for a crash if you tried to remove credentials that didn't exist
-
(
void
)
testRemoveCredentialsFromKeychain
{
[
ASIHTTPRequest
removeCredentialsForHost
:
@"apple.com"
port
:
0
protocol
:
@"http"
realm
:
@"Nothing to see here"
];
[
ASIHTTPRequest
removeCredentialsForProxy
:
@"apple.com"
port
:
0
realm
:
@"Nothing to see here"
];
}
-
(
void
)
testBasicAuthentication
{
...
...
Please
register
or
login
to post a comment