Differences From Artifact [da5c2f66e5]:
- File utils/ofhttp/OFHTTP.m — part of check-in [bc67e98833] at 2020-05-06 00:32:10 on branch trunk — Improve names of several properties (user: js, size: 28564) [annotate] [blame] [check-ins using] [more...]
To Artifact [e499272015]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[b6ee372b98]
at
2020-08-11 19:45:36
on branch trunk
— OFString: Rework number parsing API
This solves the old signed vs. unsigned problem and allows for more
bases than just 8, 10 and 16, as well as auto-detection of the base (if
base is 0). (user: js, size: 28612) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
65 66 67 68 69 70 71 | bool _detectedFileName, _quiet, _verbose, _insecure; OFStream *_body; of_http_request_method_t _method; OFMutableDictionary *_clientHeaders; OFHTTPClient *_HTTPClient; char *_buffer; OFStream *_output; | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | bool _detectedFileName, _quiet, _verbose, _insecure; OFStream *_body; of_http_request_method_t _method; OFMutableDictionary *_clientHeaders; OFHTTPClient *_HTTPClient; char *_buffer; OFStream *_output; unsigned long long _received, _length, _resumedFrom; ProgressBar *_progressBar; } - (void)downloadNextURL; @end OF_APPLICATION_DELEGATE(OFHTTP) |
︙ | ︙ | |||
372 373 374 375 376 377 378 | - (void)setProxy: (OFString *)proxy { @try { size_t pos = [proxy rangeOfString: @":" options: OF_STRING_SEARCH_BACKWARDS].location; OFString *host; | | | | | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | - (void)setProxy: (OFString *)proxy { @try { size_t pos = [proxy rangeOfString: @":" options: OF_STRING_SEARCH_BACKWARDS].location; OFString *host; unsigned long long port; if (pos == OF_NOT_FOUND) @throw [OFInvalidFormatException exception]; host = [proxy substringWithRange: of_range(0, pos)]; port = [proxy substringWithRange: of_range(pos + 1, proxy.length - pos - 1)].unsignedLongLongValue; if (port > UINT16_MAX) @throw [OFOutOfRangeException exception]; [OFTCPSocket setSOCKS5Host: host]; [OFTCPSocket setSOCKS5Port: (uint16_t)port]; } @catch (OFInvalidFormatException *e) { |
︙ | ︙ | |||
781 782 783 784 785 786 787 | [of_stdout writeFormat: @" ➜ %d\n", statusCode]; if (type == nil) type = OF_LOCALIZED(@"type_unknown", @"unknown"); if (lengthString != nil) { | | | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | [of_stdout writeFormat: @" ➜ %d\n", statusCode]; if (type == nil) type = OF_LOCALIZED(@"type_unknown", @"unknown"); if (lengthString != nil) { _length = lengthString.unsignedLongLongValue; if (_resumedFrom + _length >= GIBIBYTE) { lengthString = [OFString stringWithFormat: @"%,.2f", (float)(_resumedFrom + _length) / GIBIBYTE]; lengthString = OF_LOCALIZED(@"size_gib", @"%[num] GiB", |
︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | if (_continue) { @try { uintmax_t size = [[OFFileManager defaultManager] attributesOfItemAtPath: _currentFileName].fileSize; OFString *range; | | | | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | if (_continue) { @try { uintmax_t size = [[OFFileManager defaultManager] attributesOfItemAtPath: _currentFileName].fileSize; OFString *range; if (size > ULLONG_MAX) @throw [OFOutOfRangeException exception]; _resumedFrom = (unsigned long long)size; range = [OFString stringWithFormat: @"bytes=%jd-", _resumedFrom]; [clientHeaders setObject: range forKey: @"Range"]; } @catch (OFRetrieveItemAttributesFailedException *e) { } |
︙ | ︙ |