88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
if (full) {
[stream writeString: @"\n"];
[stream writeLine: OF_LOCALIZED(@"full_usage",
@"Options:\n "
@"-b --body "
@" Specify the file to send as body\n "
@"-c --continue "
@" Continue download of existing file\n "
@"-f --force "
@" Force / overwrite existing file\n "
@"-h --help "
@" Show this help\n "
@"-H --header "
|
>
>
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
if (full) {
[stream writeString: @"\n"];
[stream writeLine: OF_LOCALIZED(@"full_usage",
@"Options:\n "
@"-b --body "
@" Specify the file to send as body\n "
@" "
@" (- for standard input)\n "
@"-c --continue "
@" Continue download of existing file\n "
@"-f --force "
@" Force / overwrite existing file\n "
@"-h --help "
@" Show this help\n "
@"-H --header "
|
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
[_clientHeaders setObject: value
forKey: name];
}
- (void)setBody: (OFString *)path
{
uintmax_t bodySize;
[_body release];
_body = [[OFFile alloc] initWithPath: path
mode: @"r"];
bodySize = [[OFFileManager defaultManager] attributesOfItemAtPath: path]
.fileSize;
[_clientHeaders setObject: [OFString stringWithFormat: @"%ju", bodySize]
forKey: @"Content-Length"];
}
- (void)setMethod: (OFString *)method
{
void *pool = objc_autoreleasePoolPush();
method = method.uppercaseString;
|
|
>
>
>
>
>
|
|
>
|
|
>
>
>
|
|
>
>
>
>
>
>
>
|
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
[_clientHeaders setObject: value
forKey: name];
}
- (void)setBody: (OFString *)path
{
OFString *contentLength = nil;
[_body release];
_body = nil;
if ([path isEqual: @"-"])
_body = [of_stdin copy];
else {
_body = [[OFFile alloc] initWithPath: path
mode: @"r"];
@try {
uintmax_t fileSize = [[OFFileManager defaultManager]
attributesOfItemAtPath: path].fileSize;
contentLength =
[OFString stringWithFormat: @"%ju", fileSize];
[_clientHeaders setObject: contentLength
forKey: @"Content-Length"];
} @catch (OFRetrieveItemAttributesFailedException *e) {
}
}
if (contentLength == nil)
[_clientHeaders setObject: @"chunked"
forKey: @"Transfer-Encoding"];
}
- (void)setMethod: (OFString *)method
{
void *pool = objc_autoreleasePoolPush();
method = method.uppercaseString;
|