Differences From Artifact [c4c7ef8326]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[064dbe5127]
at
2018-12-11 22:57:46
on branch trunk
— Include an exception in delegate methods
Otherwise, there would be two methods for every operation: One for
success and one for failure. It also makes it easy to forget about
handling failure, so it's better to always pass an optional exception. (user: js, size: 26963) [annotate] [blame] [check-ins using]
To Artifact [5aba4f761b]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[eaf458c1e6]
at
2018-12-21 21:39:47
on branch trunk
— Remove context from OFHTTPClientDelegate
It was not very useful as for any OFHTTPClient there can only be one
active request. (user: js, size: 26839) [annotate] [blame] [check-ins using]
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - - + + | @interface OFHTTP: OFObject <OFApplicationDelegate, OFHTTPClientDelegate, OFStreamDelegate> { OFArray OF_GENERIC(OFString *) *_URLs; size_t _URLIndex; int _errorCode; OFString *_outputPath, *_currentFileName; |
︙ | |||
511 512 513 514 515 516 517 | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | - - - | [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client didCreateSocket: (OF_KINDOF(OFTCPSocket *))sock request: (OFHTTPRequest *)request |
︙ | |||
565 566 567 568 569 570 571 | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | - - - + + + - | if (!_quiet) [of_stdout writeFormat: @"☇ %@", [URL string]]; return true; } |
︙ | |||
711 712 713 714 715 716 717 | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | - | return true; } - (void)client: (OFHTTPClient *)client didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers statusCode: (int)statusCode request: (OFHTTPRequest *)request |
︙ | |||
801 802 803 804 805 806 807 | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | - - + | } } } - (void)client: (OFHTTPClient *)client didPerformRequest: (OFHTTPRequest *)request response: (OFHTTPResponse *)response |
︙ | |||
926 927 928 929 930 931 932 | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | + - + - | if (!_quiet) [of_stdout writeFormat: @"⠒ %@", [URL string]]; request = [OFHTTPRequest requestWithURL: URL]; [request setHeaders: clientHeaders]; [request setMethod: OF_HTTP_REQUEST_METHOD_HEAD]; _detectFileNameRequest = true; |
︙ | |||
967 968 969 970 971 972 973 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | + - + - | } } request = [OFHTTPRequest requestWithURL: URL]; [request setHeaders: clientHeaders]; [request setMethod: _method]; _detectFileNameRequest = false; |