Differences From Artifact [20466a8b30]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[6e42ee482f]
at
2020-10-10 10:58:30
on branch trunk
— Make HTTP status code consistently a short
It used to be a short in some places and an int in other places. (user: js, size: 29006) [annotate] [blame] [check-ins using]
To Artifact [24d165719e]:
- File utils/ofhttp/OFHTTP.m — part of check-in [3162555b75] at 2020-10-10 11:09:18 on branch trunk — ofhttp: Add --ignore-status option (user: js, size: 29319) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
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)];
|
| ︙ | ︙ |