ObjFW  Check-in [1abe5a111f]

Overview
Comment:Add of_tls_socket_class for 3rd-party TLS libs.

This removes of_http_client_tls_socket_class in favor of having one
symbol for all places where TLS would be desired.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1abe5a111ff051035a8a1e646c6ed6dba74bc2c3d97bc4cd791cd093aac075b1
User & Date: js on 2012-12-13 20:53:19
Other Links: manifest | tags
Context
2012-12-13
21:38
Remove code that got useless. check-in: 4ce82f6e28 user: js tags: trunk
20:53
Add of_tls_socket_class for 3rd-party TLS libs. check-in: 1abe5a111f user: js tags: trunk
2012-12-12
22:02
OFSet: Add a few new methods to create new sets. check-in: 12fef9798a user: js tags: trunk
Changes

Modified src/OFHTTPClient.h from [c649e6c2e2] to [0ec84f966d].

186
187
188
189
190
191
192
193
194
186
187
188
189
190
191
192









-
-
 */
- (OFHTTPRequestResult*)performRequest: (OFHTTPRequest*)request
			     redirects: (size_t)redirects;
@end

@interface OFObject (OFHTTPClientDelegate) <OFHTTPClientDelegate>
@end

extern Class of_http_client_tls_socket_class;

Modified src/OFHTTPClient.m from [27860baf5d] to [f1da42cb60].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
38
39
40
41
42
43
44


45
46
47
48
49
50
51







-
-







#import "OFTruncatedDataException.h"
#import "OFUnsupportedProtocolException.h"
#import "OFUnsupportedVersionException.h"

#import "autorelease.h"
#import "macros.h"

Class of_http_client_tls_socket_class = Nil;

static OF_INLINE void
normalize_key(char *str_)
{
	uint8_t *str = (uint8_t*)str_;
	BOOL firstLetter = YES;

	while (*str != '\0') {
142
143
144
145
146
147
148
149

150
151
152
153
154

155
156
157
158
159
160
161
162
140
141
142
143
144
145
146

147
148
149
150
151

152

153
154
155
156
157
158
159







-
+




-
+
-







		@throw [OFUnsupportedProtocolException
		    exceptionWithClass: [self class]
				   URL: URL];

	if ([scheme isEqual: @"http"])
		sock = [OFTCPSocket socket];
	else {
		if (of_http_client_tls_socket_class == Nil)
		if (of_tls_socket_class == Nil)
			@throw [OFUnsupportedProtocolException
			    exceptionWithClass: [self class]
					   URL: URL];

		sock = [[[of_http_client_tls_socket_class alloc] init]
		sock = [[[of_tls_socket_class alloc] init] autorelease];
		    autorelease];
	}

	[delegate client: self
	 didCreateSocket: sock
		 request: request];

	[sock connectToHost: [URL host]

Modified src/OFTCPSocket.h from [e5cbeb8df7] to [7bc1670242].

233
234
235
236
237
238
239








233
234
235
236
237
238
239
240
241
242
243
244
245
246
247







+
+
+
+
+
+
+
+
/*!
 * @brief Returns whether the socket is a listening socket.
 *
 * @return Whether the socket is a listening socket
 */
- (BOOL)isListening;
@end

#ifdef __cplusplus
extern "C" {
#endif
extern Class of_tls_socket_class;
#ifdef __cplusplus
}
#endif

Modified src/OFTCPSocket.m from [41e77c8735] to [d55696187d].

69
70
71
72
73
74
75


76
77
78
79
80
81
82
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84







+
+







#endif

/* References for static linking */
void _references_to_categories_of_OFTCPSocket(void)
{
	_OFTCPSocket_SOCKS5_reference = 1;
}

Class of_tls_socket_class = Nil;

static OFString *defaultSOCKS5Host = nil;
static uint16_t defaultSOCKS5Port = 1080;

@interface OFTCPSocket_ConnectThread: OFThread
{
	OFThread *sourceThread;