Overview
Comment: | ofhttp: Add -f / --force to overwrite file |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9a43c417215c5ca949e852754adeebea |
User & Date: | js on 2016-08-28 10:12:29 |
Other Links: | manifest | tags |
Context
2016-08-29
| ||
00:05 | configure: Add --disable-unicode-tables option check-in: b7b33247d6 user: js tags: trunk | |
2016-08-28
| ||
10:12 | ofhttp: Add -f / --force to overwrite file check-in: 9a43c41721 user: js tags: trunk | |
2016-08-21
| ||
14:09 | OFHTTPClient: Add response to redirect delegate check-in: a509ab7e91 user: js tags: trunk | |
Changes
Modified utils/ofhttp/OFHTTP.m from [e8263f7476] to [676c6715db].
︙ | ︙ | |||
51 52 53 54 55 56 57 | @interface OFHTTP: OFObject <OFHTTPClientDelegate> { OFArray OF_GENERIC(OFString*) *_URLs; size_t _URLIndex; int _errorCode; OFString *_outputPath; | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | @interface OFHTTP: OFObject <OFHTTPClientDelegate> { OFArray OF_GENERIC(OFString*) *_URLs; size_t _URLIndex; int _errorCode; OFString *_outputPath; bool _continue, _force, _detectFileName, _quiet, _verbose; OFDataArray *_body; of_http_request_method_t _method; OFMutableDictionary *_clientHeaders; OFHTTPClient *_HTTPClient; char *_buffer; OFStream *_output; intmax_t _received, _length, _resumedFrom; |
︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | if (full) [stream writeString: @"\nOptions:\n " @"-b --body " @" Specify the file to send as body\n " @"-c --continue " @" Continue download of existing file\n " @"-h --help " @" Show this help\n " @"-H --header " @" Add a header (e.g. X-Foo:Bar)\n " @"-m --method " @" Set the method of the HTTP request\n " @"-o --output " | > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | if (full) [stream writeString: @"\nOptions:\n " @"-b --body " @" Specify the file to send as body\n " @"-c --continue " @" Continue download of existing file\n " @"-f --force " @" Force / overwrite existing file\n " @"-h --help " @" Show this help\n " @"-H --header " @" Add a header (e.g. X-Foo:Bar)\n " @"-m --method " @" Set the method of the HTTP request\n " @"-o --output " |
︙ | ︙ | |||
223 224 225 226 227 228 229 230 231 232 233 234 235 236 | - (void)applicationDidFinishLaunching { OFString *outputPath; const of_options_parser_option_t options[] = { { 'b', @"body", 1, NULL, NULL }, { 'c', @"continue", 0, &_continue, NULL }, { 'h', @"help", 0, NULL, NULL }, { 'H', @"header", 1, NULL, NULL }, { 'm', @"method", 1, NULL, NULL }, { 'o', @"output", 1, NULL, &outputPath }, { 'O', @"detect-filename", 0, &_detectFileName, NULL }, { 'P', @"socks5-proxy", 1, NULL, NULL }, { 'q', @"quiet", 0, &_quiet, NULL }, | > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | - (void)applicationDidFinishLaunching { OFString *outputPath; const of_options_parser_option_t options[] = { { 'b', @"body", 1, NULL, NULL }, { 'c', @"continue", 0, &_continue, NULL }, { 'f', @"force", 0, &_force, NULL }, { 'h', @"help", 0, NULL, NULL }, { 'H', @"header", 1, NULL, NULL }, { 'm', @"method", 1, NULL, NULL }, { 'o', @"output", 1, NULL, &outputPath }, { 'O', @"detect-filename", 0, &_detectFileName, NULL }, { 'P', @"socks5-proxy", 1, NULL, NULL }, { 'q', @"quiet", 0, &_quiet, NULL }, |
︙ | ︙ | |||
748 749 750 751 752 753 754 | [of_stdout writeFormat: @" Size: %@\n", lengthString]; } } if ([_outputPath isEqual: @"-"]) _output = of_stdout; else { | > | | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | [of_stdout writeFormat: @" Size: %@\n", lengthString]; } } if ([_outputPath isEqual: @"-"]) _output = of_stdout; else { if (!_continue && !_force && [fileManager fileExistsAtPath: fileName]) { [of_stderr writeFormat: @"%@: File %@ already exists!\n", [OFApplication programName], fileName]; _errorCode = 1; goto next; } |
︙ | ︙ |