More SSL/TLS options support

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35618 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-09-30 10:14:00 +00:00
parent 98b5b4c973
commit 388bb2be49
6 changed files with 137 additions and 30 deletions

View file

@ -48,6 +48,7 @@
#import "NSCallBacks.h"
#import "GSURLPrivate.h"
#import "GSPrivate.h"
#import "GSTLS.h"
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
@ -999,11 +1000,45 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
}
if ([[u scheme] isEqualToString: @"https"])
{
static NSArray *keys = nil;
NSMutableDictionary *opts;
NSUInteger count;
/* If we are an https connection, negotiate secure connection.
* Make sure we are not an observer of the file handle while
* it is connecting...
*/
[nc removeObserver: self name: nil object: sock];
if (nil == keys)
{
keys = [[NSArray alloc] initWithObjects:
GSTLSCAFile,
GSTLSCertificateFile,
GSTLSCertificateKeyFile,
GSTLSCertificateKeyPassword,
GSTLSDebug,
GSTLSPriority,
GSTLSRemoteHosts,
GSTLSRevokeFile,
GSTLSVerify,
nil];
}
count = [keys count];
opts = [[NSMutableDictionary alloc] initWithCapacity: count];
while (count-- > 0)
{
NSString *key = [keys objectAtIndex: count];
NSString *str = [request objectForKey: key];
if (nil != str)
{
[opts setObject: str forKey: key];
}
}
if (debug) [opts setObject: @"YES" forKey: GSTLSDebug];
[sock sslSetOptions: opts];
[opts release];
if ([sock sslConnect] == NO)
{
if (debug)