ObjFW  Check-in [d112a476aa]

Overview
Comment:ofhttp: Fix --detect-filename
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d112a476aa4d2faa5b0d7b523a17ea6713717825738c60a00e45a62e8d1d0523
User & Date: js on 2019-03-19 01:04:30
Other Links: manifest | tags
Context
2019-03-19
01:39
ofhttp: Parse unquoted Content-Disposition check-in: ec962afb8e user: js tags: trunk
01:04
ofhttp: Fix --detect-filename check-in: d112a476aa user: js tags: trunk
00:32
ofhttp: Set _resumedFrom to 0 if statusCode != 206 check-in: 967a498fcc user: js tags: trunk
Changes

Modified utils/ofhttp/OFHTTP.m from [f89010b0ee] to [292d3ba59e].

494
495
496
497
498
499
500









501
502
503
504
505
506
507
	if (_quiet && _verbose) {
		[of_stderr writeLine: OF_LOCALIZED(@"quiet_xor_verbose",
		    @"%[prog]: -q / --quiet and -v / --verbose are mutually "
		    @"exclusive!",
		    @"prog", [OFApplication programName])];
		[OFApplication terminateWithStatus: 1];
	}










	if (_outputPath != nil && _URLs.count > 1) {
		[of_stderr writeLine:
		    OF_LOCALIZED(@"output_only_with_one_url",
		    @"%[prog]: Cannot use -o / --output when more than one URL "
		    @"has been specified!",
		    @"prog", [OFApplication programName])];







>
>
>
>
>
>
>
>
>







494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
	if (_quiet && _verbose) {
		[of_stderr writeLine: OF_LOCALIZED(@"quiet_xor_verbose",
		    @"%[prog]: -q / --quiet and -v / --verbose are mutually "
		    @"exclusive!",
		    @"prog", [OFApplication programName])];
		[OFApplication terminateWithStatus: 1];
	}

	if (_outputPath != nil && _detectFileName) {
		[of_stderr writeLine: OF_LOCALIZED(
		    @"output_xor_detect_filename",
		    @"%[prog]: -o / --output and -O / --detect-filename are "
		    @"mutually exclusive!",
		    @"prog", [OFApplication programName])];
		[OFApplication terminateWithStatus: 1];
	}

	if (_outputPath != nil && _URLs.count > 1) {
		[of_stderr writeLine:
		    OF_LOCALIZED(@"output_only_with_one_url",
		    @"%[prog]: Cannot use -o / --output when more than one URL "
		    @"has been specified!",
		    @"prog", [OFApplication programName])];
928
929
930
931
932
933
934

935
936

937
938
939
940
941
942
943
944
945
946
947
948
949
		request.method = OF_HTTP_REQUEST_METHOD_HEAD;

		_detectFileNameRequest = true;
		[_HTTPClient asyncPerformRequest: request];
		return;
	}


	[_currentFileName release];
	_currentFileName = nil;

	_detectedFileName = false;

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

	if (_outputPath != nil)
		_currentFileName = [_outputPath copy];

	if (_currentFileName == nil)
		_currentFileName = [URL.path.lastPathComponent copy];

	if (_continue) {
		@try {







>
|
|
>
|

<
<
|
<







937
938
939
940
941
942
943
944
945
946
947
948
949


950

951
952
953
954
955
956
957
		request.method = OF_HTTP_REQUEST_METHOD_HEAD;

		_detectFileNameRequest = true;
		[_HTTPClient asyncPerformRequest: request];
		return;
	}

	if (!_detectedFileName) {
		[_currentFileName release];
		_currentFileName = nil;
	} else
		_detectedFileName = false;



	if (_currentFileName == nil)

		_currentFileName = [_outputPath copy];

	if (_currentFileName == nil)
		_currentFileName = [URL.path.lastPathComponent copy];

	if (_continue) {
		@try {
960
961
962
963
964
965
966



967
968
969
970
971
972
973
974
975
976
977
978
979
							    _resumedFrom];
			[clientHeaders setObject: range
					  forKey: @"Range"];
		} @catch (OFRetrieveItemAttributesFailedException *e) {
		}
	}




	request = [OFHTTPRequest requestWithURL: URL];
	request.headers = clientHeaders;
	request.method = _method;

	_detectFileNameRequest = false;
	[_HTTPClient asyncPerformRequest: request];
	return;

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







>
>
>













968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
							    _resumedFrom];
			[clientHeaders setObject: range
					  forKey: @"Range"];
		} @catch (OFRetrieveItemAttributesFailedException *e) {
		}
	}

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

	request = [OFHTTPRequest requestWithURL: URL];
	request.headers = clientHeaders;
	request.method = _method;

	_detectFileNameRequest = false;
	[_HTTPClient asyncPerformRequest: request];
	return;

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

Modified utils/ofhttp/lang/de.json from [967b8f2fca] to [7ef06d4aaf].

25
26
27
28
29
30
31




32
33
34
35
36
37
38
    "argument_missing": "%[prog]: Argument für option -%[opt] fehlt",
    "option_takes_no_argument": "%[prog]: Option --%[opt] nimmt kein Argument",
    "unknown_long_option": "%[prog]: Unbekannte Option: --%[opt]",
    "unknown_option": "%[prog]: Unbekannte Option: -%[opt]",
    "quiet_xor_verbose": [
        "%[prog]: -q / --quiet und -v / --verbose schließen sich gegenseitig ",
        "aus!"




    ],
    "output_only_with_one_url": [
        "%[prog]: -o / --output kann nicht mit mehr als einer URL benutzt ",
        "werden!"
    ],
    "download_failed_resolve_host_failed": [
        "%[prog]: Fehler beim Download von <%[url]>!\n",







>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    "argument_missing": "%[prog]: Argument für option -%[opt] fehlt",
    "option_takes_no_argument": "%[prog]: Option --%[opt] nimmt kein Argument",
    "unknown_long_option": "%[prog]: Unbekannte Option: --%[opt]",
    "unknown_option": "%[prog]: Unbekannte Option: -%[opt]",
    "quiet_xor_verbose": [
        "%[prog]: -q / --quiet und -v / --verbose schließen sich gegenseitig ",
        "aus!"
    ],
    "output_xor_detect_filename": [
        "%[prog]: -o / --output und -O / --detect-filename schließen sich ",
        "gegenseitig aus!"
    ],
    "output_only_with_one_url": [
        "%[prog]: -o / --output kann nicht mit mehr als einer URL benutzt ",
        "werden!"
    ],
    "download_failed_resolve_host_failed": [
        "%[prog]: Fehler beim Download von <%[url]>!\n",