ObjFW  Check-in [ba6cb57178]

Overview
Comment:ofhttp: Move around the _URLIndex--

This is to make sure that the same URL is only tried again after we
successfully detected the file name, as otherwise we'd end up in an
infinite loop if we fail to detect the file name.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ba6cb571786ff4f6c28dc44c2f652004c576c3550145eb616cd3bda92d5bb9c4
User & Date: js on 2018-07-03 23:35:08
Other Links: manifest | tags
Context
2018-07-07
21:37
Add -[componentsSeparatedByCharactersInSet:] check-in: 8939d24b51 user: js tags: trunk
2018-07-03
23:35
ofhttp: Move around the _URLIndex-- check-in: ba6cb57178 user: js tags: trunk
2018-07-01
15:14
OFSystemInfo: Add ObjFW version check-in: 06cf4cc15f user: js tags: trunk
Changes

Modified utils/ofhttp/OFHTTP.m from [e2bb21d82f] to [075e25cbdb].

802
803
804
805
806
807
808



809
810
811
812
813
814
815
	    context: (id)context
{
	if ([context isEqual: @"detectFileName"]) {
		_currentFileName = [fileNameFromContentDisposition(
		    [[response headers] objectForKey: @"Content-Disposition"])
		    copy];
		_detectedFileName = true;




		[self performSelector: @selector(downloadNextURL)
			   afterDelay: 0];
		return;
	}

	if ([_outputPath isEqual: @"-"])







>
>
>







802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
	    context: (id)context
{
	if ([context isEqual: @"detectFileName"]) {
		_currentFileName = [fileNameFromContentDisposition(
		    [[response headers] objectForKey: @"Content-Disposition"])
		    copy];
		_detectedFileName = true;

		/* Handle this URL on the next -[downloadNextURL] call */
		_URLIndex--;

		[self performSelector: @selector(downloadNextURL)
			   afterDelay: 0];
		return;
	}

	if ([_outputPath isEqual: @"-"])
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
		_errorCode = 1;
		goto next;
	}

	clientHeaders = [[_clientHeaders mutableCopy] autorelease];

	if (_detectFileName && !_detectedFileName) {
		/* Handle this URL on the next -[downloadNextURL] call */
		_URLIndex--;

		if (!_quiet)
			[of_stdout writeFormat: @"⠒ %@", [URL string]];

		request = [OFHTTPRequest requestWithURL: URL];
		[request setHeaders: clientHeaders];
		[request setMethod: OF_HTTP_REQUEST_METHOD_HEAD];








<
<
<







917
918
919
920
921
922
923



924
925
926
927
928
929
930
		_errorCode = 1;
		goto next;
	}

	clientHeaders = [[_clientHeaders mutableCopy] autorelease];

	if (_detectFileName && !_detectedFileName) {



		if (!_quiet)
			[of_stdout writeFormat: @"⠒ %@", [URL string]];

		request = [OFHTTPRequest requestWithURL: URL];
		[request setHeaders: clientHeaders];
		[request setMethod: OF_HTTP_REQUEST_METHOD_HEAD];