ObjFW  Diff

Differences From Artifact [b10e234803]:

To Artifact [96bd1084f3]:


302
303
304
305
306
307
308

309
310
311
312
313
314
315
316
		do {
			tmp++;
		} while (*tmp == ' ');

		value = [OFString stringWithUTF8String: tmp];

		if ((redirects > 0 && (status == 301 || status == 302 ||

		    status == 303) && [key isEqual: @"Location"]) &&
		    (redirectsFromHTTPSToHTTPAllowed ||
		    [scheme isEqual: @"http"] ||
		    ![value hasPrefix: @"http://"])) {
			OFURL *new;
			BOOL follow;

			new = [OFURL URLWithString: value







>
|







302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
		do {
			tmp++;
		} while (*tmp == ' ');

		value = [OFString stringWithUTF8String: tmp];

		if ((redirects > 0 && (status == 301 || status == 302 ||
		    status == 303 || status == 307) &&
		    [key isEqual: @"Location"]) &&
		    (redirectsFromHTTPSToHTTPAllowed ||
		    [scheme isEqual: @"http"] ||
		    ![value hasPrefix: @"http://"])) {
			OFURL *new;
			BOOL follow;

			new = [OFURL URLWithString: value
379
380
381
382
383
384
385

386
387
388
389
390
391
392

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

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


					bytesReceived += length;
					[data addNItems: length
					     fromCArray: buffer];

					toRead -= length;
				}







>







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394

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

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

					bytesReceived += length;
					[data addNItems: length
					     fromCArray: buffer];

					toRead -= length;
				}
440
441
442
443
444
445
446
447







448
449
450
451
452
453
454

	[serverHeaders makeImmutable];

	result = [[OFHTTPRequestResult alloc] initWithStatusCode: status
							 headers: serverHeaders
							    data: data];

	if (status != 200 && status != 301 && status != 302 && status != 303) {







		[result release];
		@throw [OFHTTPRequestFailedException
		    exceptionWithClass: isa
			   HTTPRequest: self
				result: result];
	}








|
>
>
>
>
>
>
>







442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463

	[serverHeaders makeImmutable];

	result = [[OFHTTPRequestResult alloc] initWithStatusCode: status
							 headers: serverHeaders
							    data: data];

	switch (status) {
	case 200:
	case 301:
	case 302:
	case 303:
	case 307:
		break;
	default:
		[result release];
		@throw [OFHTTPRequestFailedException
		    exceptionWithClass: isa
			   HTTPRequest: self
				result: result];
	}