Overview
| Comment: | ofhttp: Add --ignore-status option |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
3162555b75431a8e189d3f9995b3816f |
| User & Date: | js on 2020-10-10 11:09:18 |
| Other Links: | manifest | tags |
Context
|
2020-10-10
| ||
| 14:27 | OFObject: Change type of -[hash] to unsigned long (check-in: aeb403a1ed user: js tags: trunk) | |
| 11:09 | ofhttp: Add --ignore-status option (check-in: 3162555b75 user: js tags: trunk) | |
| 10:58 | Make HTTP status code consistently a short (check-in: 6e42ee482f user: js tags: trunk) | |
Changes
Modified utils/ofhttp/OFHTTP.m from [20466a8b30] to [24d165719e].
| ︙ | ︙ | |||
61 62 63 64 65 66 67 |
OFStreamDelegate>
{
OFArray OF_GENERIC(OFString *) *_URLs;
size_t _URLIndex;
int _errorCode;
OFString *_outputPath, *_currentFileName;
bool _continue, _force, _detectFileName, _detectFileNameRequest;
| | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
OFStreamDelegate>
{
OFArray OF_GENERIC(OFString *) *_URLs;
size_t _URLIndex;
int _errorCode;
OFString *_outputPath, *_currentFileName;
bool _continue, _force, _detectFileName, _detectFileNameRequest;
bool _detectedFileName, _quiet, _verbose, _insecure, _ignoreStatus;
OFStream *_body;
of_http_request_method_t _method;
OFMutableDictionary *_clientHeaders;
OFHTTPClient *_HTTPClient;
char *_buffer;
OFStream *_output;
unsigned long long _received, _length, _resumedFrom;
|
| ︙ | ︙ | |||
114 115 116 117 118 119 120 | @"-P --proxy " @" Specify SOCKS5 proxy\n " @"-q --quiet " @" Quiet mode (no output, except errors)\n " @"-v --verbose " @" Verbose mode (print headers)\n " @" --insecure " | | > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | @"-P --proxy " @" Specify SOCKS5 proxy\n " @"-q --quiet " @" Quiet mode (no output, except errors)\n " @"-v --verbose " @" Verbose mode (print headers)\n " @" --insecure " @" Ignore TLS errors and allow insecure redirects\n " @" --ignore-status " @" Ignore HTTP status code")]; } [OFApplication terminateWithStatus: status]; } static OFString * fileNameFromContentDisposition(OFString *contentDisposition) |
| ︙ | ︙ | |||
425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
{ '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 },
{ 'v', @"verbose", 0, &_verbose, NULL },
{ '\0', @"insecure", 0, &_insecure, NULL },
{ '\0', nil, 0, NULL, NULL }
};
OFOptionsParser *optionsParser;
of_unichar_t option;
#ifdef OF_HAVE_SANDBOX
OFSandbox *sandbox = [OFSandbox sandbox];
| > | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
{ '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 },
{ 'v', @"verbose", 0, &_verbose, NULL },
{ '\0', @"insecure", 0, &_insecure, NULL },
{ '\0', @"ignore-status", 0, &_ignoreStatus, NULL },
{ '\0', nil, 0, NULL, NULL }
};
OFOptionsParser *optionsParser;
of_unichar_t option;
#ifdef OF_HAVE_SANDBOX
OFSandbox *sandbox = [OFSandbox sandbox];
|
| ︙ | ︙ | |||
702 703 704 705 706 707 708 |
@"%[prog]: Failed to download <%[url]>!\n"
@" %[error]: %[exception]",
@"prog", [OFApplication programName],
@"url", request.URL.string,
@"error", error,
@"exception", e)];
} else if ([e isKindOfClass: [OFHTTPRequestFailedException class]]) {
| > > > > > > > > > > | | | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 |
@"%[prog]: Failed to download <%[url]>!\n"
@" %[error]: %[exception]",
@"prog", [OFApplication programName],
@"url", request.URL.string,
@"error", error,
@"exception", e)];
} else if ([e isKindOfClass: [OFHTTPRequestFailedException class]]) {
short statusCode;
OFString *codeString;
if (_ignoreStatus) {
[self client: client
didPerformRequest: [e request]
response: [e response]];
return;
}
statusCode = [[e response] statusCode];
codeString = [OFString stringWithFormat: @"%hd %@",
statusCode, of_http_status_code_to_string(statusCode)];
[of_stderr writeLine: OF_LOCALIZED(@"download_failed",
@"%[prog]: Failed to download <%[url]>!\n"
@" HTTP status code: %[code]",
@"prog", [OFApplication programName],
@"url", request.URL.string,
@"code", codeString)];
|
| ︙ | ︙ |
Modified utils/ofhttp/lang/de.json from [ccf7a0ea89] to [ad71562e8d].
| ︙ | ︙ | |||
13 14 15 16 17 18 19 |
" -o --output Ausgabe-Dateiname angeben\n",
" -O --detect-filename Dateiname mittels HEAD-Request ermitteln\n",
" -P --proxy SOCKS5-Proxy angeben\n",
" -q --quiet Ruhiger Modus (keine Ausgabe außer Fehler)",
"\n",
" -v --verbose Ausführlicher Modus (gibt Header aus)\n",
" --insecure TLS-Fehler ignorieren und unsichere\n",
| | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
" -o --output Ausgabe-Dateiname angeben\n",
" -O --detect-filename Dateiname mittels HEAD-Request ermitteln\n",
" -P --proxy SOCKS5-Proxy angeben\n",
" -q --quiet Ruhiger Modus (keine Ausgabe außer Fehler)",
"\n",
" -v --verbose Ausführlicher Modus (gibt Header aus)\n",
" --insecure TLS-Fehler ignorieren und unsichere\n",
" Weiterleitungen erlauben\n",
" --ignore-status HTTP Status-Code ignorieren"
],
"invalid_input_header": "%[prog]: Header müssen im Format Name:Wert sein!",
"invalid_input_method": "%[prog]: Ungültige Request-Methode %[method]!",
"invalid_input_proxy": "%[prog]: Proxy muss im Format Host:Port sein!",
"long_argument_missing": "%[prog]: Argument für Option --%[opt] fehlt",
"argument_missing": "%[prog]: Argument für option -%[opt] fehlt",
"option_takes_no_argument": "%[prog]: Option --%[opt] nimmt kein Argument",
|
| ︙ | ︙ |