ObjFW  Check-in [c64d88f50f]

Overview
Comment:Make it possible to specify a TLS socket class for OFHTTPRequest.

This way, OFHTTPRequest will support HTTPS using a third party TLS
library.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c64d88f50f8084272a6edc4ac62539814ae256c53c3b3be309cdcdf0d182c99f
User & Date: js on 2011-02-24 18:27:59
Other Links: manifest | tags
Context
2011-02-25
12:02
OFHTTPRequest: Work around a bug in lighttpd with HTTPS. check-in: 73c723bf39 user: js tags: trunk
2011-02-24
18:27
Make it possible to specify a TLS socket class for OFHTTPRequest. check-in: c64d88f50f user: js tags: trunk
2011-02-19
20:30
Fix a sign issue in base64. check-in: 4d44bbf586 user: js tags: trunk
Changes

Modified src/OFHTTPRequest.h from [964ebc0e8e] to [9575ac8a9b].

150
151
152
153
154
155
156


150
151
152
153
154
155
156
157
158







+
+
- (OFDictionary*)headers;

/**
 * \return The data returned for the HTTP request
 */
- (OFDataArray*)data;
@end

extern Class of_http_request_tls_socket_class;

Modified src/OFHTTPRequest.m from [a21896a236] to [5c79012c43].

22
23
24
25
26
27
28


29
30
31
32
33
34
35
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37







+
+







#import "OFString.h"
#import "OFURL.h"
#import "OFTCPSocket.h"
#import "OFDictionary.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"

Class of_http_request_tls_socket_class = Nil;

@implementation OFHTTPRequest
+ request
{
	return [[[self alloc] init] autorelease];
}

- init
103
104
105
106
107
108
109
110


111
112
113
114

115
116
117
118












119
120
121
122
123
124
125
105
106
107
108
109
110
111

112
113
114
115
116

117
118
119


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138







-
+
+



-
+


-
-
+
+
+
+
+
+
+
+
+
+
+
+







- (OFHTTPRequestResult*)result
{
	return [self resultWithRedirects: 10];
}

- (OFHTTPRequestResult*)resultWithRedirects: (size_t)redirects
{
	OFAutoreleasePool *pool;
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *scheme = [URL scheme];
	OFTCPSocket *sock;
	OFHTTPRequestResult *result;

	if (![[URL scheme] isEqual: @"http"])
	if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"])
		@throw [OFUnsupportedProtocolException newWithClass: isa
								URL: URL];
	pool = [[OFAutoreleasePool alloc] init];
	sock = [OFTCPSocket socket];

	if ([scheme isEqual: @"http"])
		sock = [OFTCPSocket socket];
	else {
		if (of_http_request_tls_socket_class == Nil)
			@throw [OFUnsupportedProtocolException
			    newWithClass: isa
				     URL: URL];

		sock = [[[of_http_request_tls_socket_class alloc] init]
		    autorelease];
	}

	[sock connectToHost: [URL host]
		     onPort: [URL port]];

	@try {
		OFString *line;
		OFMutableDictionary *s_headers;