Differences From Artifact [cd147444d1]:
- File utils/ofhttp/OFHTTP.m — part of check-in [431116c906] at 2020-09-27 02:12:44 on branch trunk — ofhttp: Fix compiling with Apple GCC 4.2.1 (user: js, size: 29000) [annotate] [blame] [check-ins using] [more...]
To 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]
| ︙ | ︙ | |||
602 603 604 605 606 607 608 | [body writeBuffer: buffer length: length]; } } - (bool)client: (OFHTTPClient *)client shouldFollowRedirect: (OFURL *)URL | | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
[body writeBuffer: buffer
length: length];
}
}
- (bool)client: (OFHTTPClient *)client
shouldFollowRedirect: (OFURL *)URL
statusCode: (short)statusCode
request: (OFHTTPRequest *)request
response: (OFHTTPResponse *)response
{
if (_verbose) {
void *pool = objc_autoreleasePoolPush();
OFDictionary OF_GENERIC(OFString *, OFString *) *headers =
response.headers;
|
| ︙ | ︙ | |||
703 704 705 706 707 708 709 |
@" %[error]: %[exception]",
@"prog", [OFApplication programName],
@"url", request.URL.string,
@"error", error,
@"exception", e)];
} else if ([e isKindOfClass: [OFHTTPRequestFailedException class]]) {
short statusCode = [[e response] statusCode];
| | | 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
@" %[error]: %[exception]",
@"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 %@",
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)];
|
| ︙ | ︙ | |||
782 783 784 785 786 787 788 | } return true; } - (void)client: (OFHTTPClient *)client didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers | | | | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 |
}
return true;
}
- (void)client: (OFHTTPClient *)client
didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers
statusCode: (short)statusCode
request: (OFHTTPRequest *)request
{
if (statusCode != 206)
_resumedFrom = 0;
if (!_quiet) {
OFString *lengthString =
[headers objectForKey: @"Content-Length"];
OFString *type = [headers objectForKey: @"Content-Type"];
[of_stdout writeFormat: @" ➜ %hd\n", statusCode];
if (type == nil)
type = OF_LOCALIZED(@"type_unknown", @"unknown");
if (lengthString != nil) {
_length = lengthString.unsignedLongLongValue;
|
| ︙ | ︙ |