@@ -63,11 +63,11 @@ OFArray OF_GENERIC(OFString *) *_URLs; size_t _URLIndex; int _errorCode; OFString *_outputPath, *_currentFileName; bool _continue, _force, _detectFileName, _detectFileNameRequest; - bool _detectedFileName, _quiet, _verbose, _insecure; + bool _detectedFileName, _quiet, _verbose, _insecure, _ignoreStatus; OFStream *_body; of_http_request_method_t _method; OFMutableDictionary *_clientHeaders; OFHTTPClient *_HTTPClient; char *_buffer; @@ -116,11 +116,13 @@ @"-q --quiet " @" Quiet mode (no output, except errors)\n " @"-v --verbose " @" Verbose mode (print headers)\n " @" --insecure " - @" Ignore TLS errors and allow insecure redirects")]; + @" Ignore TLS errors and allow insecure redirects\n " + @" --ignore-status " + @" Ignore HTTP status code")]; } [OFApplication terminateWithStatus: status]; } @@ -427,10 +429,11 @@ { '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; @@ -704,12 +707,22 @@ @"prog", [OFApplication programName], @"url", request.URL.string, @"error", error, @"exception", e)]; } else if ([e isKindOfClass: [OFHTTPRequestFailedException class]]) { - short statusCode = [[e response] statusCode]; - OFString *codeString = [OFString stringWithFormat: @"%hd %@", + 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],