ObjFW  Diff

Differences From Artifact [4f74296a47]:

To Artifact [8d29aa8502]:


206
207
208
209
210
211
212
213
214


215
216
217
218
219
220
221
222
223
224
225
226
206
207
208
209
210
211
212


213
214
215
216
217
218

219
220
221
222
223
224
225







-
-
+
+




-







		    autorelease];
	}

	@try {
		OFString *line, *path;
		OFMutableDictionary *serverHeaders;
		OFDataArray *data;
		OFEnumerator *enumerator;
		OFString *key;
		OFEnumerator *keyEnumerator, *objectEnumerator;
		OFString *key, *object, *contentLengthHeader;
		int status;
		const char *type = NULL;
		char *buffer;
		size_t bytesReceived;
		OFString *contentLengthHeader;

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

		/*
		 * Work around a bug with packet bisection in lighttpd when
		 * using HTTPS.
245
246
247
248
249
250
251
252


253

254
255


256
257
258
259
260
261
262
263
244
245
246
247
248
249
250

251
252
253
254


255
256

257
258
259
260
261
262
263







-
+
+

+
-
-
+
+
-








		if ([URL port] == 80)
			[sock writeFormat: @"Host: %@\r\n", [URL host]];
		else
			[sock writeFormat: @"Host: %@:%d\r\n", [URL host],
					   [URL port]];

		enumerator = [headers keyEnumerator];
		keyEnumerator = [headers keyEnumerator];
		objectEnumerator = [headers objectEnumerator];

		while ((key = [keyEnumerator nextObject]) != nil &&
		while ((key = [enumerator nextObject]) != nil)
			[sock writeFormat: @"%@: %@\r\n",
		    (object = [objectEnumerator nextObject]) != nil)
			[sock writeFormat: @"%@: %@\r\n", key, object];
					   key, [headers objectForKey: key]];

		if (requestType == OF_HTTP_REQUEST_TYPE_POST) {
			if ([headers objectForKey: @"Content-Type"] == nil)
				[sock writeString: @"Content-Type: "
				   @"application/x-www-form-urlencoded\r\n"];

			if ([headers objectForKey: @"Content-Length"] == nil)