ObjFW  Diff

Differences From Artifact [456aec5d03]:

To Artifact [bba59f52c5]:


224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
224
225
226
227
228
229
230

231
232
233
234
235
236
237
238







-
+







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

	/*
	 * Work around a bug with packet bisection in lighttpd when using
	 * HTTPS.
	 */
	[sock setBuffersWrites: YES];
	[sock setWriteBufferEnabled: YES];

	if (requestType == OF_HTTP_REQUEST_TYPE_GET)
		type = "GET";
	if (requestType == OF_HTTP_REQUEST_TYPE_HEAD)
		type = "HEAD";
	if (requestType == OF_HTTP_REQUEST_TYPE_POST)
		type = "POST";
270
271
272
273
274
275
276
277

278
279
280
281
282
283
284
270
271
272
273
274
275
276

277
278
279
280
281
282
283
284







-
+







			    [queryString UTF8StringLength]];
	}

	[sock writeString: @"\r\n"];

	/* Work around a bug in lighttpd, see above */
	[sock flushWriteBuffer];
	[sock setBuffersWrites: NO];
	[sock setWriteBufferEnabled: NO];

	if (requestType == OF_HTTP_REQUEST_TYPE_POST)
		[sock writeString: queryString];

	@try {
		line = [sock readLine];
	} @catch (OFInvalidEncodingException *e) {
418
419
420
421
422
423
424
425
426


427
428
429
430
431
432
433
418
419
420
421
422
423
424


425
426
427
428
429
430
431
432
433







-
-
+
+







				    contentLength >= bytesReceived))
					break;

				while (toRead > 0) {
					size_t length = (toRead < of_pagesize
					    ? toRead : of_pagesize);

					length = [sock readNBytes: length
						       intoBuffer: buffer];
					length = [sock readIntoBuffer: buffer
							       length: length];

					[delegate request: self
					   didReceiveData: buffer
					       withLength: length];
					[pool2 releaseObjects];

					bytesReceived += length;
449
450
451
452
453
454
455
456
457



458
459
460
461
462
463
464
449
450
451
452
453
454
455


456
457
458
459
460
461
462
463
464
465







-
-
+
+
+







					    exceptionWithClass: isa];

				[pool2 releaseObjects];
			}
		} else {
			size_t length;

			while ((length = [sock readNBytes: of_pagesize
					       intoBuffer: buffer]) > 0) {
			while ((length = [sock
			    readIntoBuffer: buffer
				    length: of_pagesize]) > 0) {
				[delegate request: self
				   didReceiveData: buffer
				       withLength: length];
				[pool2 releaseObjects];

				bytesReceived += length;
				[data addItemsFromCArray: buffer