ObjOpenSSL  Diff

Differences From Artifact [0f40846643]:

To Artifact [cc5dffdd1c]:


13
14
15
16
17
18
19


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#import <ObjFW/OFOutOfRangeException.h>
#import <ObjFW/OFReadFailedException.h>
#import <ObjFW/OFWriteFailedException.h>

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif



@implementation SSLSocket
+ (void)load
{
	of_http_request_tls_socket_class = self;
}

+ (void)initialize
{
	if (self == [SSLSocket class])
		SSL_library_init();
}

- init
{
	self = [super init];

	@try {
		if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL)
			@throw [OFInitializationFailedException
			    newWithClass: isa];

		if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) &
		    SSL_OP_NO_SSLv2) == 0)
			@throw [OFInitializationFailedException
			    newWithClass: isa];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithSocket: (OFTCPSocket*)socket
{
	self = [self init];

	@try {







>
>









|
<
<
|
<
|
|

<
|
|
<

|
<
|
<
<
<
<
<
<
<







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31


32

33
34
35

36
37

38
39

40







41
42
43
44
45
46
47
#import <ObjFW/OFOutOfRangeException.h>
#import <ObjFW/OFReadFailedException.h>
#import <ObjFW/OFWriteFailedException.h>

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif

static SSL_CTX *ctx;

@implementation SSLSocket
+ (void)load
{
	of_http_request_tls_socket_class = self;
}

+ (void)initialize
{
	if (self != [SSLSocket class])


		return;


	SSL_library_init();


	if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL)
		@throw [OFInitializationFailedException newWithClass: self];


	if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2) == 0)

		@throw [OFInitializationFailedException newWithClass: self];







}

- initWithSocket: (OFTCPSocket*)socket
{
	self = [self init];

	@try {