diff --git a/CocoaHTTPServer/CocoaHTTPServer.xcodeproj/project.pbxproj b/CocoaHTTPServer/CocoaHTTPServer.xcodeproj/project.pbxproj index 3422ba3e..7c2a764e 100644 --- a/CocoaHTTPServer/CocoaHTTPServer.xcodeproj/project.pbxproj +++ b/CocoaHTTPServer/CocoaHTTPServer.xcodeproj/project.pbxproj @@ -15,13 +15,13 @@ D678F0AC2472FA6F006DB114 /* DDData.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0A62472FA6F006DB114 /* DDData.h */; }; D678F0AD2472FA6F006DB114 /* DDData.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0A72472FA6F006DB114 /* DDData.m */; }; D678F0B82472FA88006DB114 /* HTTPResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0AE2472FA88006DB114 /* HTTPResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D678F0B92472FA88006DB114 /* HTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0AF2472FA88006DB114 /* HTTPServer.m */; }; - D678F0BA2472FA88006DB114 /* HTTPServer.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B02472FA88006DB114 /* HTTPServer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D678F0B92472FA88006DB114 /* CHTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0AF2472FA88006DB114 /* CHTTPServer.m */; }; + D678F0BA2472FA88006DB114 /* CHTTPServer.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B02472FA88006DB114 /* CHTTPServer.h */; settings = {ATTRIBUTES = (Public, ); }; }; D678F0BB2472FA88006DB114 /* HTTPAuthenticationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0B12472FA88006DB114 /* HTTPAuthenticationRequest.m */; }; D678F0BC2472FA88006DB114 /* HTTPMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B22472FA88006DB114 /* HTTPMessage.h */; settings = {ATTRIBUTES = (Public, ); }; }; D678F0BD2472FA88006DB114 /* HTTPLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B32472FA88006DB114 /* HTTPLogging.h */; }; - D678F0BE2472FA88006DB114 /* HTTPConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B42472FA88006DB114 /* HTTPConnection.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D678F0BF2472FA88006DB114 /* HTTPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0B52472FA88006DB114 /* HTTPConnection.m */; }; + D678F0BE2472FA88006DB114 /* CHTTPConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B42472FA88006DB114 /* CHTTPConnection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D678F0BF2472FA88006DB114 /* CHTTPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0B52472FA88006DB114 /* CHTTPConnection.m */; }; D678F0C02472FA88006DB114 /* HTTPAuthenticationRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0B62472FA88006DB114 /* HTTPAuthenticationRequest.h */; }; D678F0C12472FA88006DB114 /* HTTPMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D678F0B72472FA88006DB114 /* HTTPMessage.m */; }; D678F0C82472FA9C006DB114 /* MultipartFormDataParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D678F0C22472FA9C006DB114 /* MultipartFormDataParser.h */; }; @@ -59,13 +59,13 @@ D678F0A62472FA6F006DB114 /* DDData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DDData.h; path = ../Core/Categories/DDData.h; sourceTree = ""; }; D678F0A72472FA6F006DB114 /* DDData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDData.m; path = ../Core/Categories/DDData.m; sourceTree = ""; }; D678F0AE2472FA88006DB114 /* HTTPResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPResponse.h; path = ../Core/HTTPResponse.h; sourceTree = ""; }; - D678F0AF2472FA88006DB114 /* HTTPServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPServer.m; path = ../Core/HTTPServer.m; sourceTree = ""; }; - D678F0B02472FA88006DB114 /* HTTPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPServer.h; path = ../Core/HTTPServer.h; sourceTree = ""; }; + D678F0AF2472FA88006DB114 /* CHTTPServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CHTTPServer.m; path = ../Core/CHTTPServer.m; sourceTree = ""; }; + D678F0B02472FA88006DB114 /* CHTTPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CHTTPServer.h; path = ../Core/CHTTPServer.h; sourceTree = ""; }; D678F0B12472FA88006DB114 /* HTTPAuthenticationRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPAuthenticationRequest.m; path = ../Core/HTTPAuthenticationRequest.m; sourceTree = ""; }; D678F0B22472FA88006DB114 /* HTTPMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPMessage.h; path = ../Core/HTTPMessage.h; sourceTree = ""; }; D678F0B32472FA88006DB114 /* HTTPLogging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPLogging.h; path = ../Core/HTTPLogging.h; sourceTree = ""; }; - D678F0B42472FA88006DB114 /* HTTPConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPConnection.h; path = ../Core/HTTPConnection.h; sourceTree = ""; }; - D678F0B52472FA88006DB114 /* HTTPConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPConnection.m; path = ../Core/HTTPConnection.m; sourceTree = ""; }; + D678F0B42472FA88006DB114 /* CHTTPConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CHTTPConnection.h; path = ../Core/CHTTPConnection.h; sourceTree = ""; }; + D678F0B52472FA88006DB114 /* CHTTPConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CHTTPConnection.m; path = ../Core/CHTTPConnection.m; sourceTree = ""; }; D678F0B62472FA88006DB114 /* HTTPAuthenticationRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPAuthenticationRequest.h; path = ../Core/HTTPAuthenticationRequest.h; sourceTree = ""; }; D678F0B72472FA88006DB114 /* HTTPMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPMessage.m; path = ../Core/HTTPMessage.m; sourceTree = ""; }; D678F0C22472FA9C006DB114 /* MultipartFormDataParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MultipartFormDataParser.h; path = ../Core/Mime/MultipartFormDataParser.h; sourceTree = ""; }; @@ -138,14 +138,14 @@ D678F09F2472FA35006DB114 /* Categories */, D678F0B62472FA88006DB114 /* HTTPAuthenticationRequest.h */, D678F0B12472FA88006DB114 /* HTTPAuthenticationRequest.m */, - D678F0B42472FA88006DB114 /* HTTPConnection.h */, - D678F0B52472FA88006DB114 /* HTTPConnection.m */, + D678F0B42472FA88006DB114 /* CHTTPConnection.h */, + D678F0B52472FA88006DB114 /* CHTTPConnection.m */, D678F0B32472FA88006DB114 /* HTTPLogging.h */, D678F0B22472FA88006DB114 /* HTTPMessage.h */, D678F0B72472FA88006DB114 /* HTTPMessage.m */, D678F0AE2472FA88006DB114 /* HTTPResponse.h */, - D678F0B02472FA88006DB114 /* HTTPServer.h */, - D678F0AF2472FA88006DB114 /* HTTPServer.m */, + D678F0B02472FA88006DB114 /* CHTTPServer.h */, + D678F0AF2472FA88006DB114 /* CHTTPServer.m */, D678F0A02472FA42006DB114 /* Mime */, D678F0A12472FA49006DB114 /* Responses */, D678F0E62472FAB9006DB114 /* WebSocket.h */, @@ -215,11 +215,11 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - D678F0BA2472FA88006DB114 /* HTTPServer.h in Headers */, + D678F0BA2472FA88006DB114 /* CHTTPServer.h in Headers */, D678F0DD2472FAAE006DB114 /* HTTPDataResponse.h in Headers */, D678F0B82472FA88006DB114 /* HTTPResponse.h in Headers */, D678F0BC2472FA88006DB114 /* HTTPMessage.h in Headers */, - D678F0BE2472FA88006DB114 /* HTTPConnection.h in Headers */, + D678F0BE2472FA88006DB114 /* CHTTPConnection.h in Headers */, D678F0E82472FAB9006DB114 /* WebSocket.h in Headers */, D678F0C02472FA88006DB114 /* HTTPAuthenticationRequest.h in Headers */, D678F0E42472FAAE006DB114 /* HTTPErrorResponse.h in Headers */, @@ -307,7 +307,7 @@ buildActionMask = 2147483647; files = ( D678F0BB2472FA88006DB114 /* HTTPAuthenticationRequest.m in Sources */, - D678F0BF2472FA88006DB114 /* HTTPConnection.m in Sources */, + D678F0BF2472FA88006DB114 /* CHTTPConnection.m in Sources */, D678F0AD2472FA6F006DB114 /* DDData.m in Sources */, D678F0DB2472FAAE006DB114 /* HTTPDynamicFileResponse.m in Sources */, D678F0AA2472FA6F006DB114 /* DDNumber.m in Sources */, @@ -315,7 +315,7 @@ D678F0CD2472FA9C006DB114 /* MultipartMessageHeader.m in Sources */, D678F0E52472FAAE006DB114 /* HTTPErrorResponse.m in Sources */, D678F0E92472FAB9006DB114 /* WebSocket.m in Sources */, - D678F0B92472FA88006DB114 /* HTTPServer.m in Sources */, + D678F0B92472FA88006DB114 /* CHTTPServer.m in Sources */, D678F0E22472FAAE006DB114 /* HTTPRedirectResponse.m in Sources */, D678F0CC2472FA9C006DB114 /* MultipartFormDataParser.m in Sources */, D678F0AB2472FA6F006DB114 /* DDRange.m in Sources */, diff --git a/CocoaHTTPServer/CocoaHTTPServer/CocoaHTTPServer.h b/CocoaHTTPServer/CocoaHTTPServer/CocoaHTTPServer.h index c6bc3e3e..6f7403fb 100644 --- a/CocoaHTTPServer/CocoaHTTPServer/CocoaHTTPServer.h +++ b/CocoaHTTPServer/CocoaHTTPServer/CocoaHTTPServer.h @@ -19,5 +19,5 @@ FOUNDATION_EXPORT const unsigned char CocoaHTTPServerVersionString[]; #import #import #import -#import -#import +#import +#import diff --git a/Core/HTTPConnection.h b/Core/CHTTPConnection.h similarity index 88% rename from Core/HTTPConnection.h rename to Core/CHTTPConnection.h index 224141cf..daa66b5a 100644 --- a/Core/HTTPConnection.h +++ b/Core/CHTTPConnection.h @@ -2,7 +2,7 @@ @class GCDAsyncSocket; @class HTTPMessage; -@class HTTPServer; +@class CHTTPServer; @class WebSocket; @protocol HTTPResponse; @@ -15,15 +15,15 @@ @interface HTTPConfig : NSObject { - HTTPServer __unsafe_unretained *server; + CHTTPServer __unsafe_unretained *server; NSString __strong *documentRoot; dispatch_queue_t queue; } -- (id)initWithServer:(HTTPServer *)server documentRoot:(NSString *)documentRoot; -- (id)initWithServer:(HTTPServer *)server documentRoot:(NSString *)documentRoot queue:(dispatch_queue_t)q; +- (id)initWithServer:(CHTTPServer *)server documentRoot:(NSString *)documentRoot; +- (id)initWithServer:(CHTTPServer *)server documentRoot:(NSString *)documentRoot queue:(dispatch_queue_t)q; -@property (nonatomic, unsafe_unretained, readonly) HTTPServer *server; +@property (nonatomic, unsafe_unretained, readonly) CHTTPServer *server; @property (nonatomic, strong, readonly) NSString *documentRoot; @property (nonatomic, readonly) dispatch_queue_t queue; @@ -33,7 +33,7 @@ #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -@interface HTTPConnection : NSObject +@interface CHTTPConnection : NSObject { dispatch_queue_t connectionQueue; GCDAsyncSocket *asyncSocket; @@ -113,7 +113,7 @@ @end -@interface HTTPConnection (AsynchronousHTTPResponse) +@interface CHTTPConnection (AsynchronousHTTPResponse) - (void)responseHasAvailableData:(NSObject *)sender; - (void)responseDidAbort:(NSObject *)sender; @end diff --git a/Core/HTTPConnection.m b/Core/CHTTPConnection.m similarity index 99% rename from Core/HTTPConnection.m rename to Core/CHTTPConnection.m index 759aa4fb..819f500e 100644 --- a/Core/HTTPConnection.m +++ b/Core/CHTTPConnection.m @@ -1,5 +1,5 @@ -#import "HTTPServer.h" -#import "HTTPConnection.h" +#import "CHTTPServer.h" +#import "CHTTPConnection.h" #import "HTTPMessage.h" #import "HTTPResponse.h" #import "HTTPAuthenticationRequest.h" @@ -81,7 +81,7 @@ // the HTTP_RESPONSE tag. For all other segments prior to the last segment use HTTP_PARTIAL_RESPONSE, or some other // tag of your own invention. -@interface HTTPConnection (PrivateAPI) +@interface CHTTPConnection (PrivateAPI) - (void)startReadingRequest; - (void)sendResponseHeadersAndBody; @end @@ -90,7 +90,7 @@ - (void)sendResponseHeadersAndBody; #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -@implementation HTTPConnection +@implementation CHTTPConnection static dispatch_queue_t recentNonceQueue; static NSMutableArray *recentNonces; @@ -2667,7 +2667,7 @@ @implementation HTTPConfig @synthesize documentRoot; @synthesize queue; -- (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoot +- (id)initWithServer:(CHTTPServer *)aServer documentRoot:(NSString *)aDocumentRoot { if ((self = [super init])) { @@ -2677,7 +2677,7 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo return self; } -- (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoot queue:(dispatch_queue_t)q +- (id)initWithServer:(CHTTPServer *)aServer documentRoot:(NSString *)aDocumentRoot queue:(dispatch_queue_t)q { if ((self = [super init])) { diff --git a/Core/HTTPServer.h b/Core/CHTTPServer.h similarity index 99% rename from Core/HTTPServer.h rename to Core/CHTTPServer.h index 1d37cb69..57d32588 100644 --- a/Core/HTTPServer.h +++ b/Core/CHTTPServer.h @@ -18,7 +18,7 @@ #endif -@interface HTTPServer : NSObject IMPLEMENTED_PROTOCOLS +@interface CHTTPServer : NSObject IMPLEMENTED_PROTOCOLS { // Underlying asynchronous TCP/IP socket GCDAsyncSocket *asyncSocket; diff --git a/Core/HTTPServer.m b/Core/CHTTPServer.m similarity index 98% rename from Core/HTTPServer.m rename to Core/CHTTPServer.m index 854f1ce2..58ecb581 100644 --- a/Core/HTTPServer.m +++ b/Core/CHTTPServer.m @@ -1,5 +1,5 @@ -#import "HTTPServer.h" -#import "HTTPConnection.h" +#import "CHTTPServer.h" +#import "CHTTPConnection.h" #import "WebSocket.h" @import CocoaAsyncSocket; @@ -11,7 +11,7 @@ //// Other flags: trace //static const int httpLogLevel = HTTP_LOG_LEVEL_ERROR; // HTTP_LOG_LEVEL_INFO; // | HTTP_LOG_FLAG_TRACE; -@interface HTTPServer (PrivateAPI) +@interface CHTTPServer (PrivateAPI) - (void)unpublishBonjour; - (void)publishBonjour; @@ -25,7 +25,7 @@ + (void)performBonjourBlock:(dispatch_block_t)block; #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -@implementation HTTPServer +@implementation CHTTPServer /** * Standard Constructor. @@ -53,7 +53,7 @@ - (id)init asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:serverQueue]; // Use default connection class of HTTPConnection - connectionClass = [HTTPConnection self]; + connectionClass = [CHTTPConnection self]; // By default bind on all available interfaces, en1, wifi etc interface = nil; @@ -451,7 +451,7 @@ - (void)stop:(BOOL)keepExistingConnections { // Stop all HTTP connections the server owns [self->connectionsLock lock]; - for (HTTPConnection *connection in self->connections) + for (CHTTPConnection *connection in self->connections) { [connection stop]; } @@ -545,7 +545,7 @@ - (HTTPConfig *)config - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket { - HTTPConnection *newConnection = (HTTPConnection *)[[connectionClass alloc] initWithAsyncSocket:newSocket + CHTTPConnection *newConnection = (CHTTPConnection *)[[connectionClass alloc] initWithAsyncSocket:newSocket configuration:[self config]]; [connectionsLock lock]; [connections addObject:newConnection]; diff --git a/Core/Responses/HTTPAsyncFileResponse.h b/Core/Responses/HTTPAsyncFileResponse.h index fd60ea83..8f38523b 100644 --- a/Core/Responses/HTTPAsyncFileResponse.h +++ b/Core/Responses/HTTPAsyncFileResponse.h @@ -1,7 +1,7 @@ #import #import "HTTPResponse.h" -@class HTTPConnection; +@class CHTTPConnection; /** * This is an asynchronous version of HTTPFileResponse. @@ -13,7 +13,7 @@ @interface HTTPAsyncFileResponse : NSObject { - HTTPConnection *connection; + CHTTPConnection *connection; NSString *filePath; UInt64 fileLength; @@ -34,7 +34,7 @@ BOOL readSourceSuspended; } -- (id)initWithFilePath:(NSString *)filePath forConnection:(HTTPConnection *)connection; +- (id)initWithFilePath:(NSString *)filePath forConnection:(CHTTPConnection *)connection; - (NSString *)filePath; @end diff --git a/Core/Responses/HTTPAsyncFileResponse.m b/Core/Responses/HTTPAsyncFileResponse.m index ee715903..834e652f 100644 --- a/Core/Responses/HTTPAsyncFileResponse.m +++ b/Core/Responses/HTTPAsyncFileResponse.m @@ -1,5 +1,5 @@ #import "HTTPAsyncFileResponse.h" -#import "HTTPConnection.h" +#import "CHTTPConnection.h" #import #import @@ -33,7 +33,7 @@ @implementation HTTPAsyncFileResponse -- (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent +- (id)initWithFilePath:(NSString *)fpath forConnection:(CHTTPConnection *)parent { if ((self = [super init])) { diff --git a/Core/Responses/HTTPDynamicFileResponse.h b/Core/Responses/HTTPDynamicFileResponse.h index d2763192..da261d89 100644 --- a/Core/Responses/HTTPDynamicFileResponse.h +++ b/Core/Responses/HTTPDynamicFileResponse.h @@ -45,7 +45,7 @@ } - (id)initWithFilePath:(NSString *)filePath - forConnection:(HTTPConnection *)connection + forConnection:(CHTTPConnection *)connection separator:(NSString *)separatorStr replacementDictionary:(NSDictionary *)dictionary; diff --git a/Core/Responses/HTTPDynamicFileResponse.m b/Core/Responses/HTTPDynamicFileResponse.m index b8fb9ee4..2cca00be 100644 --- a/Core/Responses/HTTPDynamicFileResponse.m +++ b/Core/Responses/HTTPDynamicFileResponse.m @@ -1,5 +1,5 @@ #import "HTTPDynamicFileResponse.h" -#import "HTTPConnection.h" +#import "CHTTPConnection.h" #if ! __has_feature(objc_arc) #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). @@ -15,7 +15,7 @@ @implementation HTTPDynamicFileResponse - (id)initWithFilePath:(NSString *)fpath - forConnection:(HTTPConnection *)parent + forConnection:(CHTTPConnection *)parent separator:(NSString *)separatorStr replacementDictionary:(NSDictionary *)dict { diff --git a/Core/Responses/HTTPFileResponse.h b/Core/Responses/HTTPFileResponse.h index e334f4f9..fa682451 100644 --- a/Core/Responses/HTTPFileResponse.h +++ b/Core/Responses/HTTPFileResponse.h @@ -1,12 +1,12 @@ #import #import "HTTPResponse.h" -@class HTTPConnection; +@class CHTTPConnection; @interface HTTPFileResponse : NSObject { - HTTPConnection *connection; + CHTTPConnection *connection; NSString *filePath; UInt64 fileLength; @@ -19,7 +19,7 @@ NSUInteger bufferSize; } -- (id)initWithFilePath:(NSString *)filePath forConnection:(HTTPConnection *)connection; +- (id)initWithFilePath:(NSString *)filePath forConnection:(CHTTPConnection *)connection; - (NSString *)filePath; @end diff --git a/Core/Responses/HTTPFileResponse.m b/Core/Responses/HTTPFileResponse.m index fe27ae4d..5ffd59cd 100644 --- a/Core/Responses/HTTPFileResponse.m +++ b/Core/Responses/HTTPFileResponse.m @@ -1,5 +1,5 @@ #import "HTTPFileResponse.h" -#import "HTTPConnection.h" +#import "CHTTPConnection.h" #import #import @@ -17,7 +17,7 @@ @implementation HTTPFileResponse -- (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent +- (id)initWithFilePath:(NSString *)fpath forConnection:(CHTTPConnection *)parent { if((self = [super init])) {