Differences From Artifact [9d72e08e88]:
- File utils/ofhttp/OFHTTP.m — part of check-in [325f616d84] at 2015-06-28 17:16:21 on branch trunk — {generators,utils/of{hash,http}}: Use generics (user: js, size: 18700) [annotate] [blame] [check-ins using]
To Artifact [45b5064c67]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[f3c452dfef]
at
2015-08-22 10:57:14
on branch trunk
— Move file management to its own class
This makes it possible to add support for delegates for file management
operations and on top makes it easier to add support for file management
operations on URLs. (user: js, size: 18805) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #import "OFApplication.h" #import "OFArray.h" #import "OFDataArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFHTTPClient.h" #import "OFHTTPRequest.h" #import "OFHTTPResponse.h" #import "OFOptionsParser.h" #import "OFStdIOStream.h" #import "OFSystemInfo.h" #import "OFTCPSocket.h" | > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include "config.h" #import "OFApplication.h" #import "OFArray.h" #import "OFDataArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFFileManager.h" #import "OFHTTPClient.h" #import "OFHTTPRequest.h" #import "OFHTTPResponse.h" #import "OFOptionsParser.h" #import "OFStdIOStream.h" #import "OFSystemInfo.h" #import "OFTCPSocket.h" |
︙ | ︙ | |||
538 539 540 541 542 543 544 545 546 547 548 549 550 551 | [self performSelector: @selector(downloadNextURL) afterDelay: 0]; return false; } - (void)downloadNextURL { OFString *URLString = nil; OFURL *URL; OFMutableDictionary *clientHeaders; OFHTTPRequest *request; OFHTTPResponse *response; OFDictionary OF_GENERIC(OFString*, OFString*) *headers; OFString *fileName = nil, *lengthString, *type; | > | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | [self performSelector: @selector(downloadNextURL) afterDelay: 0]; return false; } - (void)downloadNextURL { OFFileManager *fileManager = [OFFileManager defaultManager]; OFString *URLString = nil; OFURL *URL; OFMutableDictionary *clientHeaders; OFHTTPRequest *request; OFHTTPResponse *response; OFDictionary OF_GENERIC(OFString*, OFString*) *headers; OFString *fileName = nil, *lengthString, *type; |
︙ | ︙ | |||
608 609 610 611 612 613 614 | fileName = _outputPath; if (fileName == nil) fileName = [[URL path] lastPathComponent]; if (_continue) { @try { | | > | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | fileName = _outputPath; if (fileName == nil) fileName = [[URL path] lastPathComponent]; if (_continue) { @try { of_offset_t size = [fileManager sizeOfFileAtPath: fileName]; OFString *range; if (size > INTMAX_MAX) @throw [OFOutOfRangeException exception]; _resumedFrom = (intmax_t)size; |
︙ | ︙ | |||
690 691 692 693 694 695 696 | [of_stdout writeFormat: @" Size: %@\n", lengthString]; } } if ([_outputPath isEqual: @"-"]) _output = of_stdout; else { | | | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | [of_stdout writeFormat: @" Size: %@\n", lengthString]; } } if ([_outputPath isEqual: @"-"]) _output = of_stdout; else { if (!_continue && [fileManager fileExistsAtPath: fileName]) { [of_stderr writeFormat: @"%@: File %@ already exists!\n", [OFApplication programName], fileName]; _errorCode = 1; goto next; } |
︙ | ︙ |