ObjFW  Diff

Differences From Artifact [a21896a236]:

To Artifact [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;