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
Michael Mayo
2011-10-05 10:07:06 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
c27b8f550f36744dde92a952c886071136082adf
c27b8f55
2 parents
f7fe5c79
66003748
Merge pull request #264 from ikarius/master
issue #263 - proposed patch
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
Classes/ASIHTTPRequest.m
Classes/ASIHTTPRequest.m
View file @
c27b8f5
...
...
@@ -1198,18 +1198,28 @@ static NSOperationQueue *sharedQueue = nil;
// Handle SSL certificate settings
//
if
([[[[
self
url
]
scheme
]
lowercaseString
]
isEqualToString
:
@"https"
])
{
NSMutableDictionary
*
sslProperties
=
[
NSMutableDictionary
dictionaryWithCapacity
:
1
];
if
([[[[
self
url
]
scheme
]
lowercaseString
]
isEqualToString
:
@"https"
])
{
// Tell CFNetwork not to validate SSL certificates
if
(
!
[
self
validatesSecureCertificate
])
{
[
sslProperties
setObject
:(
NSString
*
)
kCFBooleanFalse
forKey
:(
NSString
*
)
kCFStreamSSLValidatesCertificateChain
];
}
// see: http://iphonedevelopment.blogspot.com/2010/05/nsstream-tcp-and-ssl.html
NSDictionary
*
sslProperties
=
[[
NSDictionary
alloc
]
initWithObjectsAndKeys
:
[
NSNumber
numberWithBool
:
YES
],
kCFStreamSSLAllowsExpiredCertificates
,
[
NSNumber
numberWithBool
:
YES
],
kCFStreamSSLAllowsAnyRoot
,
[
NSNumber
numberWithBool
:
NO
],
kCFStreamSSLValidatesCertificateChain
,
kCFNull
,
kCFStreamSSLPeerName
,
nil
];
CFReadStreamSetProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertySSLSettings
,
(
CFTypeRef
)
sslProperties
);
}
// Tell CFNetwork to use a client certificate
if
(
clientCertificateIdentity
)
{
NSMutableDictionary
*
sslProperties
=
[
NSMutableDictionary
dictionaryWithCapacity
:
1
];
NSMutableArray
*
certificates
=
[
NSMutableArray
arrayWithCapacity
:[
clientCertificates
count
]
+
1
];
// The first object in the array is our SecIdentityRef
...
...
@@ -1219,10 +1229,12 @@ static NSOperationQueue *sharedQueue = nil;
for
(
id
cert
in
clientCertificates
)
{
[
certificates
addObject
:
cert
];
}
[
sslProperties
setObject
:
certificates
forKey
:(
NSString
*
)
kCFStreamSSLCertificates
];
CFReadStreamSetProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertySSLSettings
,
sslProperties
);
}
CFReadStreamSetProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertySSLSettings
,
sslProperties
);
}
//
...
...
Please
register
or
login
to post a comment