Differences From Artifact [8920dc599a]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[510628432f]
at
2020-12-22 13:16:28
on branch 1.0
— Make OFSandbox private
It is unclear whether the same API can be applied to other sandboxing
frameworks. (user: js, size: 29395) [annotate] [blame] [check-ins using]
To Artifact [febf489eba]:
- File utils/ofhttp/OFHTTP.m — part of check-in [62edb405b9] at 2020-12-22 20:19:50 on branch 1.0 — Merge trunk into 1.0 branch (user: js, size: 29836) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | { 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; | > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | { OFArray OF_GENERIC(OFString *) *_URLs; size_t _URLIndex; int _errorCode; OFString *_outputPath, *_currentFileName; bool _continue, _force, _detectFileName, _detectFileNameRequest; bool _detectedFileName, _quiet, _verbose, _insecure, _ignoreStatus; bool _useUnicode; OFStream *_body; of_http_request_method_t _method; OFMutableDictionary *_clientHeaders; OFHTTPClient *_HTTPClient; char *_buffer; OFStream *_output; unsigned long long _received, _length, _resumedFrom; |
︙ | ︙ | |||
573 574 575 576 577 578 579 580 581 582 583 584 585 586 | @"prog", [OFApplication programName])]; [OFApplication terminateWithStatus: 1]; } if (_insecure) _HTTPClient.allowsInsecureRedirects = true; [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client didCreateSocket: (OFTCPSocket *)sock request: (OFHTTPRequest *)request | > > | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | @"prog", [OFApplication programName])]; [OFApplication terminateWithStatus: 1]; } if (_insecure) _HTTPClient.allowsInsecureRedirects = true; _useUnicode = ([OFLocale encoding] == OF_STRING_ENCODING_UTF_8); [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client didCreateSocket: (OFTCPSocket *)sock request: (OFHTTPRequest *)request |
︙ | ︙ | |||
624 625 626 627 628 629 630 | (object = [objectEnumerator nextObject]) != nil) [of_stdout writeFormat: @" %@: %@\n", key, object]; objc_autoreleasePoolPop(pool); } | | > | > > > | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | (object = [objectEnumerator nextObject]) != nil) [of_stdout writeFormat: @" %@: %@\n", key, object]; objc_autoreleasePoolPop(pool); } if (!_quiet) { if (_useUnicode) [of_stdout writeFormat: @"☇ %@", URL.string]; else [of_stdout writeFormat: @"< %@", URL.string]; } _length = 0; return true; } - (bool)stream: (OFStream *)response |
︙ | ︙ | |||
706 707 708 709 710 711 712 | _resumedFrom = 0; if (!_quiet) { OFString *lengthString = [headers objectForKey: @"Content-Length"]; OFString *type = [headers objectForKey: @"Content-Type"]; | > | > > | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | _resumedFrom = 0; if (!_quiet) { OFString *lengthString = [headers objectForKey: @"Content-Length"]; OFString *type = [headers objectForKey: @"Content-Type"]; if (_useUnicode) [of_stdout writeFormat: @" ➜ %hd\n", statusCode]; else [of_stdout writeFormat: @" -> %hd\n", statusCode]; if (type == nil) type = OF_LOCALIZED(@"type_unknown", @"unknown"); if (lengthString != nil) { _length = lengthString.unsignedLongLongValue; |
︙ | ︙ | |||
959 960 961 962 963 964 965 | goto next; } } if (!_quiet) { _progressBar = [[ProgressBar alloc] initWithLength: _length | | > | 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | goto next; } } if (!_quiet) { _progressBar = [[ProgressBar alloc] initWithLength: _length resumedFrom: _resumedFrom useUnicode: _useUnicode]; [_progressBar setReceived: _received]; [_progressBar draw]; } [_currentFileName release]; _currentFileName = nil; |
︙ | ︙ | |||
1022 1023 1024 1025 1026 1027 1028 | _errorCode = 1; goto next; } clientHeaders = [[_clientHeaders mutableCopy] autorelease]; if (_detectFileName && !_detectedFileName) { | | > | > > > | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | _errorCode = 1; goto next; } clientHeaders = [[_clientHeaders mutableCopy] autorelease]; if (_detectFileName && !_detectedFileName) { if (!_quiet) { if (_useUnicode) [of_stdout writeFormat: @"⠒ %@", URL.string]; else [of_stdout writeFormat: @"? %@", URL.string]; } request = [OFHTTPRequest requestWithURL: URL]; request.headers = clientHeaders; request.method = OF_HTTP_REQUEST_METHOD_HEAD; _detectFileNameRequest = true; [_HTTPClient asyncPerformRequest: request]; |
︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | _resumedFrom]; [clientHeaders setObject: range forKey: @"Range"]; } @catch (OFRetrieveItemAttributesFailedException *e) { } } | | > | > > > | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | _resumedFrom]; [clientHeaders setObject: range forKey: @"Range"]; } @catch (OFRetrieveItemAttributesFailedException *e) { } } if (!_quiet) { if (_useUnicode) [of_stdout writeFormat: @"⇣ %@", URL.string]; else [of_stdout writeFormat: @"< %@", URL.string]; } request = [OFHTTPRequest requestWithURL: URL]; request.headers = clientHeaders; request.method = _method; _detectFileNameRequest = false; [_HTTPClient asyncPerformRequest: request]; |
︙ | ︙ |