Skip to content

Commit efb1f9f

Browse files
committed
First pass at implementing class 1 WebDAV server
1 parent 93c6a9b commit efb1f9f

5 files changed

Lines changed: 643 additions & 2 deletions

File tree

GCDWebDAVServer/GCDWebDAVServer.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
Copyright (c) 2012-2014, Pierre-Olivier Latour
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
* The name of Pierre-Olivier Latour may not be used to endorse
13+
or promote products derived from this software without specific
14+
prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY
20+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
// Requires HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2" in Xcode build settings
29+
30+
#import "GCDWebServer.h"
31+
32+
@class GCDWebDAVServer;
33+
34+
@protocol GCDWebDAVServerDelegate <NSObject>
35+
@optional
36+
- (void)davServer:(GCDWebDAVServer*)uploader didDownloadFileAtPath:(NSString*)path;
37+
- (void)davServer:(GCDWebDAVServer*)uploader didUploadFileAtPath:(NSString*)path;
38+
- (void)davServer:(GCDWebDAVServer*)uploader didMoveItemFromPath:(NSString*)fromPath toPath:(NSString*)toPath;
39+
- (void)davServer:(GCDWebDAVServer*)uploader didCopyItemFromPath:(NSString*)fromPath toPath:(NSString*)toPath;
40+
- (void)davServer:(GCDWebDAVServer*)uploader didDeleteItemAtPath:(NSString*)path;
41+
- (void)davServer:(GCDWebDAVServer*)uploader didCreateDirectoryAtPath:(NSString*)path;
42+
@end
43+
44+
@interface GCDWebDAVServer : GCDWebServer
45+
@property(nonatomic, readonly) NSString* uploadDirectory;
46+
@property(nonatomic, assign) id<GCDWebDAVServerDelegate> delegate;
47+
@property(nonatomic, copy) NSArray* allowedFileExtensions; // Default is nil i.e. all file extensions are allowed
48+
@property(nonatomic) BOOL showHiddenFiles; // Default is NO
49+
- (id)initWithUploadDirectory:(NSString*)path;
50+
@end
51+
52+
@interface GCDWebDAVServer (Subclassing)
53+
- (BOOL)shouldUploadFileAtPath:(NSString*)path withTemporaryFile:(NSString*)tempPath; // Default implementation returns YES
54+
- (BOOL)shouldMoveItemFromPath:(NSString*)fromPath toPath:(NSString*)toPath; // Default implementation returns YES
55+
- (BOOL)shouldCopyItemFromPath:(NSString*)fromPath toPath:(NSString*)toPath; // Default implementation returns YES
56+
- (BOOL)shouldDeleteItemAtPath:(NSString*)path; // Default implementation returns YES
57+
- (BOOL)shouldCreateDirectoryAtPath:(NSString*)path; // Default implementation returns YES
58+
@end

0 commit comments

Comments
 (0)