-
Notifications
You must be signed in to change notification settings - Fork 595
/
Copy pathDELETEResponse.m
49 lines (38 loc) · 1004 Bytes
/
DELETEResponse.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#import "DELETEResponse.h"
#import "HTTPLogging.h"
// HTTP methods: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
// HTTP headers: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
// HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN;
@implementation DELETEResponse
- (id) initWithFilePath:(NSString*)path {
if ((self = [super init])) {
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path];
if ([[NSFileManager defaultManager] removeItemAtPath:path error:NULL]) {
_status = exists ? 200 : 204;
} else {
HTTPLogError(@"Failed deleting \"%@\"", path);
_status = 404;
}
}
return self;
}
- (UInt64) contentLength {
return 0;
}
- (UInt64) offset {
return 0;
}
- (void)setOffset:(UInt64)offset {
;
}
- (NSData*) readDataOfLength:(NSUInteger)length {
return nil;
}
- (BOOL) isDone {
return YES;
}
- (NSInteger) status {
return _status;
}
@end