Skip to content
Browse files

Fixing WebServerIPhone example

  • Loading branch information...
1 parent ae1e2ef commit d982c56709ac1e7df929f6e9610df8d540f9bef1 @robbiehanson robbiehanson committed Mar 29, 2012
Showing with 853 additions and 896 deletions.
  1. +0 −1 Xcode/WebServerIPhone/Classes/MyHTTPConnection.h
  2. +113 −35 Xcode/WebServerIPhone/Classes/MyHTTPConnection.m
  3. +2 −0 Xcode/WebServerIPhone/Classes/WebSocketLogger.h
  4. +9 −14 Xcode/WebServerIPhone/Classes/WebSocketLogger.m
  5. +79 −27 Xcode/WebServerIPhone/Vendor/CocoaAsyncSocket/GCDAsyncSocket.h
  6. +411 −507 Xcode/WebServerIPhone/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m
  7. +3 −2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Categories/DDData.m
  8. +13 −23 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPAuthenticationRequest.m
  9. +4 −4 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPConnection.h
  10. +95 −126 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPConnection.m
  11. +1 −1 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPLogging.h
  12. +23 −12 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPMessage.m
  13. +1 −1 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPResponse.h
  14. +45 −77 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPServer.m
  15. +5 −6 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPAsyncFileResponse.m
  16. +5 −3 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPDataResponse.m
  17. +6 −6 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPDynamicFileResponse.m
  18. +4 −4 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPFileResponse.m
  19. +4 −2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPRedirectResponse.m
  20. +2 −2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/WebSocket.h
  21. +10 −25 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/WebSocket.m
  22. +18 −18 Xcode/WebServerIPhone/WebServerIPhone.xcodeproj/project.pbxproj
View
1 Xcode/WebServerIPhone/Classes/MyHTTPConnection.h
@@ -4,5 +4,4 @@
@interface MyHTTPConnection : HTTPConnection
-
@end
View
148 Xcode/WebServerIPhone/Classes/MyHTTPConnection.m
@@ -13,6 +13,59 @@
@implementation MyHTTPConnection
+static NSMutableSet *webSocketLoggers;
+
+/**
+ * The runtime sends initialize to each class in a program exactly one time just before the class,
+ * or any class that inherits from it, is sent its first message from within the program. (Thus the
+ * method may never be invoked if the class is not used.) The runtime sends the initialize message to
+ * classes in a thread-safe manner. Superclasses receive this message before their subclasses.
+ *
+ * This method may also be called directly (assumably by accident), hence the safety mechanism.
+**/
++ (void)initialize
+{
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+
+ // We need some place to store the webSocketLogger instances.
+ // So we'll store them here, in a class variable.
+ //
+ // We'll also use a simple notification system to release them when they die.
+
+ webSocketLoggers = [[NSMutableSet alloc] init];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(webSocketLoggerDidDie:)
+ name:WebSocketLoggerDidDieNotification
+ object:nil];
+ });
+}
+
++ (void)addWebSocketLogger:(WebSocketLogger *)webSocketLogger
+{
+ @synchronized(webSocketLoggers)
+ {
+ [webSocketLoggers addObject:webSocketLogger];
+ }
+}
+
++ (void)webSocketLoggerDidDie:(NSNotification *)notification
+{
+ @synchronized(webSocketLoggers)
+ {
+ [webSocketLoggers removeObject:[notification object]];
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#pragma mark Utilities
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Returns the logFileManager, which is a part of the DDFileLogger system.
+ * The DDLogFileManager is the subsystem which manages the location and creation of log files.
+**/
- (id <DDLogFileManager>)logFileManager
{
WebServerIPhoneAppDelegate *appDelegate;
@@ -21,6 +74,38 @@ @implementation MyHTTPConnection
return appDelegate.fileLogger.logFileManager;
}
+/**
+ * Dynamic discovery of proper websocket href.
+**/
+- (NSString *)wsLocation
+{
+ NSString *port = [NSString stringWithFormat:@"%hu", [asyncSocket localPort]];
+
+ NSString *wsLocation;
+ NSString *wsHost = [request headerField:@"Host"];
+
+ if (wsHost == nil)
+ {
+ wsLocation = [NSString stringWithFormat:@"ws://localhost:%@/livelog", port];
+ }
+ else
+ {
+ wsLocation = [NSString stringWithFormat:@"ws://%@/livelog", wsHost];
+ }
+
+ return wsLocation;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#pragma mark /logs.html
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Returns the response body for requests to "/logs/index.html".
+ *
+ * The response is generated dynamically.
+ * It returns the list of log files currently on the system, along with their creation date and file size.
+**/
- (NSData *)generateIndexData
{
NSArray *sortedLogFileInfos = [[self logFileManager] sortedLogFileInfos];
@@ -83,40 +168,37 @@ - (NSData *)generateIndexData
return [response dataUsingEncoding:NSUTF8StringEncoding];
}
-- (NSString *)filePathForURI:(NSString *)path
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#pragma mark HTTPConnection
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Overrides method in HTTPConnection.
+ *
+ * This method is invoked to retrieve the filePath for a given URI.
+ * We override it to provide proper mapping for log file paths.
+**/
+- (NSString *)filePathForURI:(NSString *)path allowDirectory:(BOOL)allowDirectory
{
if ([path hasPrefix:@"/logs/"])
{
NSString *logsDir = [[self logFileManager] logsDirectory];
return [logsDir stringByAppendingPathComponent:[path lastPathComponent]];
}
- return [super filePathForURI:path];
-}
-
-- (NSString *)wsLocation
-{
- NSString *port = [NSString stringWithFormat:@"%hu", [asyncSocket localPort]];
-
- NSString *wsLocation;
- NSString *wsHost = [request headerField:@"Host"];
-
- if (wsHost == nil)
- {
- wsLocation = [NSString stringWithFormat:@"ws://localhost:%@/livelog", port];
- }
- else
- {
- wsLocation = [NSString stringWithFormat:@"ws://%@/livelog", wsHost];
- }
-
- return wsLocation;
+ // Fall through
+ return [super filePathForURI:path allowDirectory:allowDirectory];
}
+/**
+ * Overrides method in HTTPConnection.
+**/
- (NSObject<HTTPResponse> *)httpResponseForMethod:(NSString *)method URI:(NSString *)path
{
if ([path isEqualToString:@"/logs.html"])
{
+ // Dynamically generate html response with list of available log files
+
NSData *indexData = [self generateIndexData];
return [[HTTPDataResponse alloc] initWithData:indexData];
}
@@ -139,30 +221,26 @@ - (NSString *)wsLocation
separator:@"%%"
replacementDictionary:replacementDict];
}
- else
- {
- return [super httpResponseForMethod:method URI:path];
- }
+
+ // Fall through
+ return [super httpResponseForMethod:method URI:path];
}
+/**
+ * Overrides method in HTTPConnection.
+**/
- (WebSocket *)webSocketForURI:(NSString *)path
{
if ([path isEqualToString:@"/livelog"])
{
// Create the WebSocket
- WebSocket *ws = [[WebSocket alloc] initWithRequest:request socket:asyncSocket];
+ WebSocket *webSocket = [[WebSocket alloc] initWithRequest:request socket:asyncSocket];
// Create the WebSocketLogger
- WebSocketLogger *wsLogger = [[WebSocketLogger alloc] initWithWebSocket:ws];
-
- // Todo - Broken under ARC. Needs a fix. Commens below from pre-arc.
- //
- // Memory management:
- // The WebSocket will be retained by the HTTPServer and the WebSocketLogger.
- // The WebSocketLogger will be retained by the logging framework,
- // as it adds itself to the list of active loggers from within its init method.
+ WebSocketLogger *webSocketLogger = [[WebSocketLogger alloc] initWithWebSocket:webSocket];
- return ws;
+ [[self class] addWebSocketLogger:webSocketLogger];
+ return webSocket;
}
return [super webSocketForURI:path];
View
2 Xcode/WebServerIPhone/Classes/WebSocketLogger.h
@@ -3,6 +3,8 @@
#import "WebSocket.h"
+#define WebSocketLoggerDidDieNotification @"WebSocketLoggerDidDie"
+
@interface WebSocketLogger : DDAbstractLogger <DDLogger>
{
WebSocket *websocket;
View
23 Xcode/WebServerIPhone/Classes/WebSocketLogger.m
@@ -12,21 +12,13 @@ - (id)initWithWebSocket:(WebSocket *)ws
websocket.delegate = self;
formatter = [[WebSocketFormatter alloc] init];
-
- // Add our logger
- //
- // We do this here (as opposed to in webSocketDidOpen:) so the logging framework will retain us.
- // This is important as nothing else is retaining us.
- // It may be a bit hackish, but it's also the simplest solution.
- [DDLog addLogger:self];
}
return self;
}
- (void)dealloc
{
[websocket setDelegate:nil];
-
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -38,6 +30,9 @@ - (void)webSocketDidOpen:(WebSocket *)ws
// This method is invoked on the websocketQueue
isWebSocketOpen = YES;
+
+ // Add our logger
+ [DDLog addLogger:self];
}
- (void)webSocketDidClose:(WebSocket *)ws
@@ -48,6 +43,9 @@ - (void)webSocketDidClose:(WebSocket *)ws
// Remove our logger
[DDLog removeLogger:self];
+
+ // Post notification
+ [[NSNotificationCenter defaultCenter] postNotificationName:WebSocketLoggerDidDieNotification object:self];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -73,17 +71,14 @@ - (void)logMessage:(DDLogMessage *)logMessage
if (logMsg)
{
- dispatch_async(websocket.websocketQueue, ^{
+ dispatch_async(websocket.websocketQueue, ^{ @autoreleasepool {
if (isWebSocketOpen)
{
- @autoreleasepool {
-
- [websocket sendMessage:logMsg];
+ [websocket sendMessage:logMsg];
- }
}
- });
+ }});
}
}
View
106 Xcode/WebServerIPhone/Vendor/CocoaAsyncSocket/GCDAsyncSocket.h
@@ -46,7 +46,7 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
uint32_t flags;
uint16_t config;
- id delegate;
+ __weak id delegate;
dispatch_queue_t delegateQueue;
int socket4FD;
@@ -271,7 +271,7 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
/**
* Connects to the given address, specified as a sockaddr structure wrapped in a NSData object.
- * For example, a NSData object returned from NSNetservice's addresses method.
+ * For example, a NSData object returned from NSNetService's addresses method.
*
* If you have an existing struct sockaddr you can convert it to a NSData object like so:
* struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len];
@@ -291,7 +291,7 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* Connects to the given address, using the specified interface and timeout.
*
* The address is specified as a sockaddr structure wrapped in a NSData object.
- * For example, a NSData object returned from NSNetservice's addresses method.
+ * For example, a NSData object returned from NSNetService's addresses method.
*
* If you have an existing struct sockaddr you can convert it to a NSData object like so:
* struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len];
@@ -449,9 +449,10 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* If the bufferOffset is greater than the length of the given buffer,
* the method will do nothing, and the delegate will not be called.
*
- * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
+ * If you pass a buffer, you must not alter it in any way while the socket is using it.
* After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer.
- * That is, it will reference the bytes that were appended to the given buffer.
+ * That is, it will reference the bytes that were appended to the given buffer via
+ * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO].
**/
- (void)readDataWithTimeout:(NSTimeInterval)timeout
buffer:(NSMutableData *)buffer
@@ -471,9 +472,10 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* If the bufferOffset is greater than the length of the given buffer,
* the method will do nothing, and the delegate will not be called.
*
- * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
+ * If you pass a buffer, you must not alter it in any way while the socket is using it.
* After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer.
- * That is, it will reference the bytes that were appended to the given buffer.
+ * That is, it will reference the bytes that were appended to the given buffer via
+ * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO].
**/
- (void)readDataWithTimeout:(NSTimeInterval)timeout
buffer:(NSMutableData *)buffer
@@ -504,7 +506,8 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
*
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
* After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer.
- * That is, it will reference the bytes that were appended to the given buffer.
+ * That is, it will reference the bytes that were appended to the given buffer via
+ * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO].
**/
- (void)readDataToLength:(NSUInteger)length
withTimeout:(NSTimeInterval)timeout
@@ -518,11 +521,20 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* If the timeout value is negative, the read operation will not use a timeout.
*
* If you pass nil or zero-length data as the "data" parameter,
- * the method will do nothing, and the delegate will not be called.
+ * the method will do nothing (except maybe print a warning), and the delegate will not be called.
*
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
- * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
- * a character, the read will prematurely end.
+ * If you're developing your own custom protocol, be sure your separator can not occur naturally as
+ * part of the data between separators.
+ * For example, imagine you want to send several small documents over a socket.
+ * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents.
+ * In this particular example, it would be better to use a protocol similar to HTTP with
+ * a header that includes the length of the document.
+ * Also be careful that your separator cannot occur naturally as part of the encoding for a character.
+ *
+ * The given data (separator) parameter should be immutable.
+ * For performance reasons, the socket will retain it, not copy it.
+ * So if it is immutable, don't modify it while the socket is using it.
**/
- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
@@ -535,15 +547,25 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* If the buffer if nil, a buffer will automatically be created for you.
*
* If the bufferOffset is greater than the length of the given buffer,
- * the method will do nothing, and the delegate will not be called.
+ * the method will do nothing (except maybe print a warning), and the delegate will not be called.
*
- * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
+ * If you pass a buffer, you must not alter it in any way while the socket is using it.
* After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer.
- * That is, it will reference the bytes that were appended to the given buffer.
+ * That is, it will reference the bytes that were appended to the given buffer via
+ * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO].
*
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
- * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
- * a character, the read will prematurely end.
+ * If you're developing your own custom protocol, be sure your separator can not occur naturally as
+ * part of the data between separators.
+ * For example, imagine you want to send several small documents over a socket.
+ * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents.
+ * In this particular example, it would be better to use a protocol similar to HTTP with
+ * a header that includes the length of the document.
+ * Also be careful that your separator cannot occur naturally as part of the encoding for a character.
+ *
+ * The given data (separator) parameter should be immutable.
+ * For performance reasons, the socket will retain it, not copy it.
+ * So if it is immutable, don't modify it while the socket is using it.
**/
- (void)readDataToData:(NSData *)data
withTimeout:(NSTimeInterval)timeout
@@ -562,13 +584,22 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end.
*
* If you pass nil or zero-length data as the "data" parameter,
- * the method will do nothing, and the delegate will not be called.
+ * the method will do nothing (except maybe print a warning), and the delegate will not be called.
* If you pass a maxLength parameter that is less than the length of the data parameter,
- * the method will do nothing, and the delegate will not be called.
+ * the method will do nothing (except maybe print a warning), and the delegate will not be called.
*
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
- * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
- * a character, the read will prematurely end.
+ * If you're developing your own custom protocol, be sure your separator can not occur naturally as
+ * part of the data between separators.
+ * For example, imagine you want to send several small documents over a socket.
+ * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents.
+ * In this particular example, it would be better to use a protocol similar to HTTP with
+ * a header that includes the length of the document.
+ * Also be careful that your separator cannot occur naturally as part of the encoding for a character.
+ *
+ * The given data (separator) parameter should be immutable.
+ * For performance reasons, the socket will retain it, not copy it.
+ * So if it is immutable, don't modify it while the socket is using it.
**/
- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag;
@@ -585,18 +616,28 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError.
* The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end.
*
- * If you pass a maxLength parameter that is less than the length of the data parameter,
- * the method will do nothing, and the delegate will not be called.
+ * If you pass a maxLength parameter that is less than the length of the data (separator) parameter,
+ * the method will do nothing (except maybe print a warning), and the delegate will not be called.
* If the bufferOffset is greater than the length of the given buffer,
- * the method will do nothing, and the delegate will not be called.
+ * the method will do nothing (except maybe print a warning), and the delegate will not be called.
*
- * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
+ * If you pass a buffer, you must not alter it in any way while the socket is using it.
* After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer.
- * That is, it will reference the bytes that were appended to the given buffer.
+ * That is, it will reference the bytes that were appended to the given buffer via
+ * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO].
*
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
- * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
- * a character, the read will prematurely end.
+ * If you're developing your own custom protocol, be sure your separator can not occur naturally as
+ * part of the data between separators.
+ * For example, imagine you want to send several small documents over a socket.
+ * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents.
+ * In this particular example, it would be better to use a protocol similar to HTTP with
+ * a header that includes the length of the document.
+ * Also be careful that your separator cannot occur naturally as part of the encoding for a character.
+ *
+ * The given data (separator) parameter should be immutable.
+ * For performance reasons, the socket will retain it, not copy it.
+ * So if it is immutable, don't modify it while the socket is using it.
**/
- (void)readDataToData:(NSData *)data
withTimeout:(NSTimeInterval)timeout
@@ -612,6 +653,17 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
*
* If you pass in nil or zero-length data, this method does nothing and the delegate will not be called.
* If the timeout value is negative, the write operation will not use a timeout.
+ *
+ * Thread-Safety Note:
+ * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while
+ * the socket is writing it. In other words, it's not safe to alter the data until after the delegate method
+ * socket:didWriteDataWithTag: is invoked signifying that this particular write operation has completed.
+ * This is due to the fact that GCDAsyncSocket does NOT copy the data. It simply retains it.
+ * This is for performance reasons. Often times, if NSMutableData is passed, it is because
+ * a request/response was built up in memory. Copying this data adds an unwanted/unneeded overhead.
+ * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket
+ * completes writing the bytes (which is NOT immediately after this method returns, but rather at a later time
+ * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method.
**/
- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
View
918 Xcode/WebServerIPhone/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m
411 additions, 507 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
5 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Categories/DDData.m
@@ -38,7 +38,7 @@ - (NSString *)hexStringValue
[stringBuffer appendFormat:@"%02x", (unsigned long)dataBuffer[i]];
}
- return [[stringBuffer copy] autorelease];
+ return [stringBuffer copy];
}
- (NSString *)base64Encoded
@@ -101,7 +101,8 @@ - (NSData *)base64Decoded
unsigned long ixtext = 0;
unsigned long lentext = [self length];
unsigned char ch = 0;
- unsigned char inbuf[4], outbuf[3];
+ unsigned char inbuf[4] = {0, 0, 0, 0};
+ unsigned char outbuf[3] = {0, 0, 0};
short i = 0, ixinbuf = 0;
BOOL flignore = NO;
BOOL flendtext = NO;
View
36 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPAuthenticationRequest.m
@@ -1,6 +1,10 @@
#import "HTTPAuthenticationRequest.h"
#import "HTTPMessage.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
@interface HTTPAuthenticationRequest (PrivateAPI)
- (NSString *)quotedSubHeaderFieldValue:(NSString *)param fromHeaderFieldValue:(NSString *)header;
- (NSString *)nonquotedSubHeaderFieldValue:(NSString *)param fromHeaderFieldValue:(NSString *)header;
@@ -29,18 +33,18 @@ - (id)initWithRequest:(HTTPMessage *)request
if (isBasic)
{
- NSMutableString *temp = [[[authInfo substringFromIndex:6] mutableCopy] autorelease];
- CFStringTrimWhitespace((CFMutableStringRef)temp);
+ NSMutableString *temp = [[authInfo substringFromIndex:6] mutableCopy];
+ CFStringTrimWhitespace((__bridge CFMutableStringRef)temp);
base64Credentials = [temp copy];
}
if (isDigest)
{
- username = [[self quotedSubHeaderFieldValue:@"username" fromHeaderFieldValue:authInfo] retain];
- realm = [[self quotedSubHeaderFieldValue:@"realm" fromHeaderFieldValue:authInfo] retain];
- nonce = [[self quotedSubHeaderFieldValue:@"nonce" fromHeaderFieldValue:authInfo] retain];
- uri = [[self quotedSubHeaderFieldValue:@"uri" fromHeaderFieldValue:authInfo] retain];
+ username = [self quotedSubHeaderFieldValue:@"username" fromHeaderFieldValue:authInfo];
+ realm = [self quotedSubHeaderFieldValue:@"realm" fromHeaderFieldValue:authInfo];
+ nonce = [self quotedSubHeaderFieldValue:@"nonce" fromHeaderFieldValue:authInfo];
+ uri = [self quotedSubHeaderFieldValue:@"uri" fromHeaderFieldValue:authInfo];
// It appears from RFC 2617 that the qop is to be given unquoted
// Tests show that Firefox performs this way, but Safari does not
@@ -50,29 +54,15 @@ - (id)initWithRequest:(HTTPMessage *)request
{
qop = [self quotedSubHeaderFieldValue:@"qop" fromHeaderFieldValue:authInfo];
}
- [qop retain];
- nc = [[self nonquotedSubHeaderFieldValue:@"nc" fromHeaderFieldValue:authInfo] retain];
- cnonce = [[self quotedSubHeaderFieldValue:@"cnonce" fromHeaderFieldValue:authInfo] retain];
- response = [[self quotedSubHeaderFieldValue:@"response" fromHeaderFieldValue:authInfo] retain];
+ nc = [self nonquotedSubHeaderFieldValue:@"nc" fromHeaderFieldValue:authInfo];
+ cnonce = [self quotedSubHeaderFieldValue:@"cnonce" fromHeaderFieldValue:authInfo];
+ response = [self quotedSubHeaderFieldValue:@"response" fromHeaderFieldValue:authInfo];
}
}
return self;
}
-- (void)dealloc
-{
- [base64Credentials release];
- [username release];
- [realm release];
- [nonce release];
- [uri release];
- [qop release];
- [nc release];
- [cnonce release];
- [response release];
- [super dealloc];
-}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Accessors:
View
8 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPConnection.h
@@ -15,16 +15,16 @@
@interface HTTPConfig : NSObject
{
- HTTPServer *server;
- NSString *documentRoot;
+ HTTPServer __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;
-@property (nonatomic, readonly) HTTPServer *server;
-@property (nonatomic, readonly) NSString *documentRoot;
+@property (nonatomic, unsafe_unretained, readonly) HTTPServer *server;
+@property (nonatomic, strong, readonly) NSString *documentRoot;
@property (nonatomic, readonly) dispatch_queue_t queue;
@end
View
221 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPConnection.m
@@ -12,6 +12,10 @@
#import "WebSocket.h"
#import "HTTPLogging.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels: off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -89,6 +93,7 @@ - (void)sendResponseHeadersAndBody;
@implementation HTTPConnection
+static dispatch_queue_t recentNonceQueue;
static NSMutableArray *recentNonces;
/**
@@ -97,23 +102,66 @@ @implementation HTTPConnection
**/
+ (void)initialize
{
- static BOOL initialized = NO;
- if(!initialized)
- {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+
// Initialize class variables
+ recentNonceQueue = dispatch_queue_create("HTTPConnection-Nonce", NULL);
recentNonces = [[NSMutableArray alloc] initWithCapacity:5];
+ });
+}
+
+/**
+ * Generates and returns an authentication nonce.
+ * A nonce is a server-specified string uniquely generated for each 401 response.
+ * The default implementation uses a single nonce for each session.
+**/
++ (NSString *)generateNonce
+{
+ // We use the Core Foundation UUID class to generate a nonce value for us
+ // UUIDs (Universally Unique Identifiers) are 128-bit values guaranteed to be unique.
+ CFUUIDRef theUUID = CFUUIDCreate(NULL);
+ NSString *newNonce = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, theUUID);
+ CFRelease(theUUID);
+
+ // We have to remember that the HTTP protocol is stateless.
+ // Even though with version 1.1 persistent connections are the norm, they are not guaranteed.
+ // Thus if we generate a nonce for this connection,
+ // it should be honored for other connections in the near future.
+ //
+ // In fact, this is absolutely necessary in order to support QuickTime.
+ // When QuickTime makes it's initial connection, it will be unauthorized, and will receive a nonce.
+ // It then disconnects, and creates a new connection with the nonce, and proper authentication.
+ // If we don't honor the nonce for the second connection, QuickTime will repeat the process and never connect.
+
+ dispatch_async(recentNonceQueue, ^{ @autoreleasepool {
- initialized = YES;
- }
+ [recentNonces addObject:newNonce];
+ }});
+
+ double delayInSeconds = TIMEOUT_NONCE;
+ dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
+ dispatch_after(popTime, recentNonceQueue, ^{ @autoreleasepool {
+
+ [recentNonces removeObject:newNonce];
+ }});
+
+ return newNonce;
}
/**
- * This method is designed to be called by a scheduled timer, and will remove a nonce from the recent nonce list.
- * The nonce to remove should be set as the timer's userInfo.
+ * Returns whether or not the given nonce is in the list of recently generated nonce's.
**/
-+ (void)removeRecentNonce:(NSTimer *)aTimer
++ (BOOL)hasRecentNonce:(NSString *)recentNonce
{
- [recentNonces removeObject:[aTimer userInfo]];
+ __block BOOL result = NO;
+
+ dispatch_sync(recentNonceQueue, ^{ @autoreleasepool {
+
+ result = [recentNonces containsObject:recentNonce];
+ }});
+
+ return result;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -142,11 +190,11 @@ - (id)initWithAsyncSocket:(GCDAsyncSocket *)newSocket configuration:(HTTPConfig
}
// Take over ownership of the socket
- asyncSocket = [newSocket retain];
+ asyncSocket = newSocket;
[asyncSocket setDelegate:self delegateQueue:connectionQueue];
// Store configuration
- config = [aConfig retain];
+ config = aConfig;
// Initialize lastNC (last nonce count).
// Used with digest access authentication.
@@ -174,27 +222,17 @@ - (void)dealloc
[asyncSocket setDelegate:nil delegateQueue:NULL];
[asyncSocket disconnect];
- [asyncSocket release];
- [config release];
- [request release];
- [nonce release];
if ([httpResponse respondsToSelector:@selector(connectionDidClose)])
{
[httpResponse connectionDidClose];
}
- [httpResponse release];
- [ranges release];
- [ranges_headers release];
- [ranges_boundry release];
- [responseDataSizes release];
- [super dealloc];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -360,49 +398,14 @@ - (NSString *)passwordForUser:(NSString *)username
}
/**
- * Generates and returns an authentication nonce.
- * A nonce is a server-specified string uniquely generated for each 401 response.
- * The default implementation uses a single nonce for each session.
-**/
-- (NSString *)generateNonce
-{
- HTTPLogTrace();
-
- // We use the Core Foundation UUID class to generate a nonce value for us
- // UUIDs (Universally Unique Identifiers) are 128-bit values guaranteed to be unique.
- CFUUIDRef theUUID = CFUUIDCreate(NULL);
- NSString *newNonce = [NSMakeCollectable(CFUUIDCreateString(NULL, theUUID)) autorelease];
- CFRelease(theUUID);
-
- // We have to remember that the HTTP protocol is stateless.
- // Even though with version 1.1 persistent connections are the norm, they are not guaranteed.
- // Thus if we generate a nonce for this connection,
- // it should be honored for other connections in the near future.
- //
- // In fact, this is absolutely necessary in order to support QuickTime.
- // When QuickTime makes it's initial connection, it will be unauthorized, and will receive a nonce.
- // It then disconnects, and creates a new connection with the nonce, and proper authentication.
- // If we don't honor the nonce for the second connection, QuickTime will repeat the process and never connect.
-
- [recentNonces addObject:newNonce];
-
- [NSTimer scheduledTimerWithTimeInterval:TIMEOUT_NONCE
- target:[HTTPConnection class]
- selector:@selector(removeRecentNonce:)
- userInfo:newNonce
- repeats:NO];
- return newNonce;
-}
-
-/**
* Returns whether or not the user is properly authenticated.
**/
- (BOOL)isAuthenticated
{
HTTPLogTrace();
// Extract the authentication information from the Authorization header
- HTTPAuthenticationRequest *auth = [[[HTTPAuthenticationRequest alloc] initWithRequest:request] autorelease];
+ HTTPAuthenticationRequest *auth = [[HTTPAuthenticationRequest alloc] initWithRequest:request];
if ([self useDigestAccessAuthentication])
{
@@ -443,10 +446,9 @@ - (BOOL)isAuthenticated
{
// The given nonce may be from another connection
// We need to search our list of recent nonce strings that have been recently distributed
- if ([recentNonces containsObject:[auth nonce]])
+ if ([[self class] hasRecentNonce:[auth nonce]])
{
// Store nonce in local (cached) nonce variable to prevent array searches in the future
- [nonce release];
nonce = [[auth nonce] copy];
// The client has switched to using a different nonce value
@@ -503,7 +505,7 @@ - (BOOL)isAuthenticated
NSData *temp = [[base64Credentials dataUsingEncoding:NSUTF8StringEncoding] base64Decoded];
- NSString *credentials = [[[NSString alloc] initWithData:temp encoding:NSUTF8StringEncoding] autorelease];
+ NSString *credentials = [[NSString alloc] initWithData:temp encoding:NSUTF8StringEncoding];
// The credentials should be of the form "username:password"
// The username is not allowed to contain a colon
@@ -538,7 +540,7 @@ - (void)addDigestAuthChallenge:(HTTPMessage *)response
HTTPLogTrace();
NSString *authFormat = @"Digest realm=\"%@\", qop=\"auth\", nonce=\"%@\"";
- NSString *authInfo = [NSString stringWithFormat:authFormat, [self realm], [self generateNonce]];
+ NSString *authInfo = [NSString stringWithFormat:authFormat, [self realm], [[self class] generateNonce]];
[response setHeaderField:@"WWW-Authenticate" value:authInfo];
}
@@ -566,17 +568,14 @@ - (void)addBasicAuthChallenge:(HTTPMessage *)response
**/
- (void)start
{
- dispatch_async(connectionQueue, ^{
-
- if (started) return;
- started = YES;
-
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_async(connectionQueue, ^{ @autoreleasepool {
- [self startConnection];
-
- [pool drain];
- });
+ if (!started)
+ {
+ started = YES;
+ [self startConnection];
+ }
+ }});
}
/**
@@ -585,15 +584,12 @@ - (void)start
**/
- (void)stop
{
- dispatch_async(connectionQueue, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_async(connectionQueue, ^{ @autoreleasepool {
// Disconnect the socket.
// The socketDidDisconnect delegate method will handle everything else.
[asyncSocket disconnect];
-
- [pool drain];
- });
+ }});
}
/**
@@ -681,13 +677,13 @@ - (NSDictionary *)parseParams:(NSString *)query
{
CFStringRef k, v;
- k = CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)escapedKey, CFSTR(""));
- v = CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)escapedValue, CFSTR(""));
+ k = CFURLCreateStringByReplacingPercentEscapes(NULL, (__bridge CFStringRef)escapedKey, CFSTR(""));
+ v = CFURLCreateStringByReplacingPercentEscapes(NULL, (__bridge CFStringRef)escapedValue, CFSTR(""));
NSString *key, *value;
- key = [NSMakeCollectable(k) autorelease];
- value = [NSMakeCollectable(v) autorelease];
+ key = (__bridge_transfer NSString *)k;
+ value = (__bridge_transfer NSString *)v;
if (key)
{
@@ -766,19 +762,18 @@ - (BOOL)parseRangeRequest:(NSString *)rangeHeader withContentLength:(UInt64)cont
NSUInteger tIndex = eqsignRange.location;
NSUInteger fIndex = eqsignRange.location + eqsignRange.length;
- NSString *rangeType = [[[rangeHeader substringToIndex:tIndex] mutableCopy] autorelease];
- NSString *rangeValue = [[[rangeHeader substringFromIndex:fIndex] mutableCopy] autorelease];
+ NSMutableString *rangeType = [[rangeHeader substringToIndex:tIndex] mutableCopy];
+ NSMutableString *rangeValue = [[rangeHeader substringFromIndex:fIndex] mutableCopy];
- CFStringTrimWhitespace((CFMutableStringRef)rangeType);
- CFStringTrimWhitespace((CFMutableStringRef)rangeValue);
+ CFStringTrimWhitespace((__bridge CFMutableStringRef)rangeType);
+ CFStringTrimWhitespace((__bridge CFMutableStringRef)rangeValue);
if([rangeType caseInsensitiveCompare:@"bytes"] != NSOrderedSame) return NO;
NSArray *rangeComponents = [rangeValue componentsSeparatedByString:@","];
if([rangeComponents count] == 0) return NO;
- [ranges release];
ranges = [[NSMutableArray alloc] initWithCapacity:[rangeComponents count]];
rangeIndex = 0;
@@ -906,7 +901,6 @@ - (void)replyToHTTPRequest
NSString *tempStr = [[NSString alloc] initWithData:tempData encoding:NSUTF8StringEncoding];
HTTPLogVerbose(@"%@[%p]: Received HTTP request:\n%@", THIS_FILE, self, tempStr);
- [tempStr release];
}
// Check the HTTP version
@@ -953,7 +947,6 @@ - (void)replyToHTTPRequest
{
// The WebSocket is using the socket,
// so make sure we don't disconnect it in the dealloc method.
- [asyncSocket release];
asyncSocket = nil;
[self die];
@@ -998,7 +991,7 @@ - (void)replyToHTTPRequest
// Note: We already checked to ensure the method was supported in onSocket:didReadData:withTag:
// Respond properly to HTTP 'GET' and 'HEAD' commands
- httpResponse = [[self httpResponseForMethod:method URI:uri] retain];
+ httpResponse = [self httpResponseForMethod:method URI:uri];
if (httpResponse == nil)
{
@@ -1067,7 +1060,7 @@ - (HTTPMessage *)newMultiRangeResponse:(UInt64)contentLength
ranges_headers = [[NSMutableArray alloc] initWithCapacity:[ranges count]];
CFUUIDRef theUUID = CFUUIDCreate(NULL);
- ranges_boundry = NSMakeCollectable(CFUUIDCreateString(NULL, theUUID));
+ ranges_boundry = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
NSString *startingBoundryStr = [NSString stringWithFormat:@"\r\n--%@\r\n", ranges_boundry];
@@ -1131,9 +1124,9 @@ - (NSData *)chunkedTransferFooter
- (void)sendResponseHeadersAndBody
{
- if ([httpResponse respondsToSelector:@selector(delayResponeHeaders)])
+ if ([httpResponse respondsToSelector:@selector(delayResponseHeaders)])
{
- if ([httpResponse delayResponeHeaders])
+ if ([httpResponse delayResponseHeaders])
{
return;
}
@@ -1315,7 +1308,6 @@ - (void)sendResponseHeadersAndBody
}
}
- [response release];
}
/**
@@ -1683,7 +1675,7 @@ - (NSString *)filePathForURI:(NSString *)path allowDirectory:(BOOL)allowDirector
if (filePath && [[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDir] && !isDir)
{
- return [[[HTTPFileResponse alloc] initWithFilePath:filePath forConnection:self] autorelease];
+ return [[HTTPFileResponse alloc] initWithFilePath:filePath forConnection:self];
// Use me instead for asynchronous file IO.
// Generally better for larger files.
@@ -1773,7 +1765,6 @@ - (void)handleVersionNotSupported:(NSString *)version
NSData *responseData = [self preprocessErrorResponse:response];
[asyncSocket writeData:responseData withTimeout:TIMEOUT_WRITE_ERROR tag:HTTP_RESPONSE];
- [response release];
}
/**
@@ -1803,7 +1794,6 @@ - (void)handleAuthenticationFailed
NSData *responseData = [self preprocessErrorResponse:response];
[asyncSocket writeData:responseData withTimeout:TIMEOUT_WRITE_ERROR tag:HTTP_RESPONSE];
- [response release];
}
/**
@@ -1827,7 +1817,6 @@ - (void)handleInvalidRequest:(NSData *)data
NSData *responseData = [self preprocessErrorResponse:response];
[asyncSocket writeData:responseData withTimeout:TIMEOUT_WRITE_ERROR tag:HTTP_FINAL_RESPONSE];
- [response release];
// Note: We used the HTTP_FINAL_RESPONSE tag to disconnect after the response is sent.
// We do this because we couldn't parse the request,
@@ -1856,7 +1845,6 @@ - (void)handleUnknownMethod:(NSString *)method
NSData *responseData = [self preprocessErrorResponse:response];
[asyncSocket writeData:responseData withTimeout:TIMEOUT_WRITE_ERROR tag:HTTP_FINAL_RESPONSE];
- [response release];
// Note: We used the HTTP_FINAL_RESPONSE tag to disconnect after the response is sent.
// We do this because the method may include an http body.
@@ -1881,7 +1869,6 @@ - (void)handleResourceNotFound
NSData *responseData = [self preprocessErrorResponse:response];
[asyncSocket writeData:responseData withTimeout:TIMEOUT_WRITE_ERROR tag:HTTP_RESPONSE];
- [response release];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1918,7 +1905,7 @@ - (NSString *)dateAsString:(NSDate *)date
[df setFormatterBehavior:NSDateFormatterBehavior10_4];
[df setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
[df setDateFormat:@"EEE, dd MMM y HH:mm:ss 'GMT'"];
- [df setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]];
+ [df setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
// For some reason, using zzz in the format string produces GMT+00:00
});
@@ -2218,8 +2205,9 @@ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData*)data withTag:(long)ta
// possibly followed by a semicolon and extra parameters that can be ignored,
// and ending with CRLF.
- NSString *sizeLine = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
+ NSString *sizeLine = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ errno = 0; // Reset errno before calling strtoull() to ensure it is always zero on success
requestChunkSize = (UInt64)strtoull([sizeLine UTF8String], NULL, 16);
requestChunkSizeReceived = 0;
@@ -2486,7 +2474,6 @@ - (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)err;
{
HTTPLogTrace();
- [asyncSocket release];
asyncSocket = nil;
[self die];
@@ -2512,16 +2499,14 @@ - (void)responseHasAvailableData:(NSObject<HTTPResponse> *)sender
// We do this to give the HTTPResponse classes the flexibility to call
// this method whenever they want, even from within a readDataOfLength method.
- dispatch_async(connectionQueue, ^{
+ dispatch_async(connectionQueue, ^{ @autoreleasepool {
if (sender != httpResponse)
{
HTTPLogWarn(@"%@[%p]: %@ - Sender is not current httpResponse", THIS_FILE, self, THIS_METHOD);
return;
}
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
if (!sentResponseHeaders)
{
[self sendResponseHeadersAndBody];
@@ -2540,9 +2525,7 @@ - (void)responseHasAvailableData:(NSObject<HTTPResponse> *)sender
[self continueSendingMultiRangeResponseBody];
}
}
-
- [pool drain];
- });
+ }});
}
/**
@@ -2559,20 +2542,16 @@ - (void)responseDidAbort:(NSObject<HTTPResponse> *)sender
// We do this to give the HTTPResponse classes the flexibility to call
// this method whenever they want, even from within a readDataOfLength method.
- dispatch_async(connectionQueue, ^{
+ dispatch_async(connectionQueue, ^{ @autoreleasepool {
if (sender != httpResponse)
{
HTTPLogWarn(@"%@[%p]: %@ - Sender is not current httpResponse", THIS_FILE, self, THIS_METHOD);
return;
}
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
[asyncSocket disconnectAfterWriting];
-
- [pool drain];
- });
+ }});
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2593,15 +2572,10 @@ - (void)finishResponse
//
// If you override this method, you should take care to invoke [super finishResponse] at some point.
- [request release];
request = nil;
- [httpResponse release];
httpResponse = nil;
- [ranges release];
- [ranges_headers release];
- [ranges_boundry release];
ranges = nil;
ranges_headers = nil;
ranges_boundry = nil;
@@ -2669,7 +2643,6 @@ - (void)die
}
// Release the http response so we don't call it's connectionDidClose method again in our dealloc method
- [httpResponse release];
httpResponse = nil;
// Post notification of dead connection
@@ -2693,8 +2666,8 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo
{
if ((self = [super init]))
{
- server = [aServer retain];
- documentRoot = [aDocumentRoot retain];
+ server = aServer;
+ documentRoot = aDocumentRoot;
}
return self;
}
@@ -2703,14 +2676,13 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo
{
if ((self = [super init]))
{
- server = [aServer retain];
+ server = aServer;
documentRoot = [aDocumentRoot stringByStandardizingPath];
if ([documentRoot hasSuffix:@"/"])
{
documentRoot = [documentRoot stringByAppendingString:@"/"];
}
- [documentRoot retain];
if (q)
{
@@ -2723,13 +2695,10 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo
- (void)dealloc
{
- [server release];
- [documentRoot release];
if (queue)
dispatch_release(queue);
- [super dealloc];
}
@end
View
2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPLogging.h
@@ -2,7 +2,7 @@
* In order to provide fast and flexible logging, this project uses Cocoa Lumberjack.
*
* The Google Code page has a wealth of documentation if you have any questions.
- * http://code.google.com/p/cocoalumberjack/
+ * https://github.com/robbiehanson/CocoaLumberjack
*
* Here's what you need to know concerning how logging is setup for CocoaHTTPServer:
*
View
35 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPMessage.m
@@ -1,5 +1,9 @@
#import "HTTPMessage.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
@implementation HTTPMessage
@@ -16,7 +20,10 @@ - (id)initRequestWithMethod:(NSString *)method URL:(NSURL *)url version:(NSStrin
{
if ((self = [super init]))
{
- message = CFHTTPMessageCreateRequest(NULL, (CFStringRef)method, (CFURLRef)url, (CFStringRef)version);
+ message = CFHTTPMessageCreateRequest(NULL,
+ (__bridge CFStringRef)method,
+ (__bridge CFURLRef)url,
+ (__bridge CFStringRef)version);
}
return self;
}
@@ -25,7 +32,10 @@ - (id)initResponseWithStatusCode:(NSInteger)code description:(NSString *)descrip
{
if ((self = [super init]))
{
- message = CFHTTPMessageCreateResponse(NULL, (CFIndex)code, (CFStringRef)description, (CFStringRef)version);
+ message = CFHTTPMessageCreateResponse(NULL,
+ (CFIndex)code,
+ (__bridge CFStringRef)description,
+ (__bridge CFStringRef)version);
}
return self;
}
@@ -36,7 +46,6 @@ - (void)dealloc
{
CFRelease(message);
}
- [super dealloc];
}
- (BOOL)appendData:(NSData *)data
@@ -51,17 +60,17 @@ - (BOOL)isHeaderComplete
- (NSString *)version
{
- return [NSMakeCollectable(CFHTTPMessageCopyVersion(message)) autorelease];
+ return (__bridge_transfer NSString *)CFHTTPMessageCopyVersion(message);
}
- (NSString *)method
{
- return [NSMakeCollectable(CFHTTPMessageCopyRequestMethod(message)) autorelease];
+ return (__bridge_transfer NSString *)CFHTTPMessageCopyRequestMethod(message);
}
- (NSURL *)url
{
- return [NSMakeCollectable(CFHTTPMessageCopyRequestURL(message)) autorelease];
+ return (__bridge_transfer NSURL *)CFHTTPMessageCopyRequestURL(message);
}
- (NSInteger)statusCode
@@ -71,32 +80,34 @@ - (NSInteger)statusCode
- (NSDictionary *)allHeaderFields
{
- return [NSMakeCollectable(CFHTTPMessageCopyAllHeaderFields(message)) autorelease];
+ return (__bridge_transfer NSDictionary *)CFHTTPMessageCopyAllHeaderFields(message);
}
- (NSString *)headerField:(NSString *)headerField
{
- return [NSMakeCollectable(CFHTTPMessageCopyHeaderFieldValue(message, (CFStringRef)headerField)) autorelease];
+ return (__bridge_transfer NSString *)CFHTTPMessageCopyHeaderFieldValue(message, (__bridge CFStringRef)headerField);
}
- (void)setHeaderField:(NSString *)headerField value:(NSString *)headerFieldValue
{
- CFHTTPMessageSetHeaderFieldValue(message, (CFStringRef)headerField, (CFStringRef)headerFieldValue);
+ CFHTTPMessageSetHeaderFieldValue(message,
+ (__bridge CFStringRef)headerField,
+ (__bridge CFStringRef)headerFieldValue);
}
- (NSData *)messageData
{
- return [NSMakeCollectable(CFHTTPMessageCopySerializedMessage(message)) autorelease];
+ return (__bridge_transfer NSData *)CFHTTPMessageCopySerializedMessage(message);
}
- (NSData *)body
{
- return [NSMakeCollectable(CFHTTPMessageCopyBody(message)) autorelease];
+ return (__bridge_transfer NSData *)CFHTTPMessageCopyBody(message);
}
- (void)setBody:(NSData *)body
{
- CFHTTPMessageSetBody(message, (CFDataRef)body);
+ CFHTTPMessageSetBody(message, (__bridge CFDataRef)body);
}
@end
View
2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPResponse.h
@@ -53,7 +53,7 @@
*
* Important: You should read the discussion at the bottom of this header.
**/
-- (BOOL)delayResponeHeaders;
+- (BOOL)delayResponseHeaders;
/**
* Status code for response.
View
122 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPServer.m
@@ -4,6 +4,10 @@
#import "WebSocket.h"
#import "HTTPLogging.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels: off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_INFO; // | HTTP_LOG_FLAG_TRACE;
@@ -104,23 +108,6 @@ - (void)dealloc
dispatch_release(connectionQueue);
[asyncSocket setDelegate:nil delegateQueue:NULL];
- [asyncSocket release];
-
- [documentRoot release];
- [interface release];
-
- [netService release];
- [domain release];
- [name release];
- [type release];
- [txtRecordDictionary release];
-
- [connections release];
- [webSockets release];
- [connectionsLock release];
- [webSocketsLock release];
-
- [super dealloc];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -137,10 +124,10 @@ - (NSString *)documentRoot
__block NSString *result;
dispatch_sync(serverQueue, ^{
- result = [documentRoot retain];
+ result = documentRoot;
});
- return [result autorelease];
+ return result;
}
- (void)setDocumentRoot:(NSString *)value
@@ -160,11 +147,9 @@ - (void)setDocumentRoot:(NSString *)value
NSString *valueCopy = [value copy];
dispatch_async(serverQueue, ^{
- [documentRoot release];
- documentRoot = [valueCopy retain];
+ documentRoot = valueCopy;
});
- [valueCopy release];
}
/**
@@ -201,22 +186,20 @@ - (NSString *)interface
__block NSString *result;
dispatch_sync(serverQueue, ^{
- result = [interface retain];
+ result = interface;
});
- return [result autorelease];
+ return result;
}
- (void)setInterface:(NSString *)value
{
NSString *valueCopy = [value copy];
dispatch_async(serverQueue, ^{
- [interface release];
- interface = [valueCopy retain];
+ interface = valueCopy;
});
- [valueCopy release];
}
/**
@@ -267,10 +250,10 @@ - (NSString *)domain
__block NSString *result;
dispatch_sync(serverQueue, ^{
- result = [domain retain];
+ result = domain;
});
- return [domain autorelease];
+ return domain;
}
- (void)setDomain:(NSString *)value
@@ -280,11 +263,9 @@ - (void)setDomain:(NSString *)value
NSString *valueCopy = [value copy];
dispatch_async(serverQueue, ^{
- [domain release];
- domain = [valueCopy retain];
+ domain = valueCopy;
});
- [valueCopy release];
}
/**
@@ -297,10 +278,10 @@ - (NSString *)name
__block NSString *result;
dispatch_sync(serverQueue, ^{
- result = [name retain];
+ result = name;
});
- return [name autorelease];
+ return name;
}
- (NSString *)publishedName
@@ -324,19 +305,17 @@ - (NSString *)publishedName
}
});
- return [result autorelease];
+ return result;
}
- (void)setName:(NSString *)value
{
NSString *valueCopy = [value copy];
dispatch_async(serverQueue, ^{
- [name release];
- name = [valueCopy retain];
+ name = valueCopy;
});
- [valueCopy release];
}
/**
@@ -348,22 +327,20 @@ - (NSString *)type
__block NSString *result;
dispatch_sync(serverQueue, ^{
- result = [type retain];
+ result = type;
});
- return [result autorelease];
+ return result;
}
- (void)setType:(NSString *)value
{
NSString *valueCopy = [value copy];
dispatch_async(serverQueue, ^{
- [type release];
- type = [valueCopy retain];
+ type = valueCopy;
});
- [valueCopy release];
}
/**
@@ -374,10 +351,10 @@ - (NSDictionary *)TXTRecordDictionary
__block NSDictionary *result;
dispatch_sync(serverQueue, ^{
- result = [txtRecordDictionary retain];
+ result = txtRecordDictionary;
});
- return [result autorelease];
+ return result;
}
- (void)setTXTRecordDictionary:(NSDictionary *)value
{
@@ -387,8 +364,7 @@ - (void)setTXTRecordDictionary:(NSDictionary *)value
dispatch_async(serverQueue, ^{
- [txtRecordDictionary release];
- txtRecordDictionary = [valueCopy retain];
+ txtRecordDictionary = valueCopy;
// Update the txtRecord of the netService if it has already been published
if (netService)
@@ -406,7 +382,6 @@ - (void)setTXTRecordDictionary:(NSDictionary *)value
}
});
- [valueCopy release];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -420,8 +395,7 @@ - (BOOL)start:(NSError **)errPtr
__block BOOL success = YES;
__block NSError *err = nil;
- dispatch_sync(serverQueue, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_sync(serverQueue, ^{ @autoreleasepool {
success = [asyncSocket acceptOnInterface:interface port:port error:&err];
if (success)
@@ -434,16 +408,11 @@ - (BOOL)start:(NSError **)errPtr
else
{
HTTPLogError(@"%@: Failed to start HTTP Server: %@", THIS_FILE, err);
- [err retain];
}
-
- [pool drain];
- });
+ }});
if (errPtr)
- *errPtr = [err autorelease];
- else
- [err release];
+ *errPtr = err;
return success;
}
@@ -457,8 +426,7 @@ - (void)stop:(BOOL)keepExistingConnections
{
HTTPLogTrace();
- dispatch_sync(serverQueue, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_sync(serverQueue, ^{ @autoreleasepool {
// First stop publishing the service via bonjour
[self unpublishBonjour];
@@ -487,9 +455,7 @@ - (void)stop:(BOOL)keepExistingConnections
[webSockets removeAllObjects];
[webSocketsLock unlock];
}
-
- [pool drain];
- });
+ }});
}
- (BOOL)isRunning
@@ -562,7 +528,7 @@ - (HTTPConfig *)config
// Try the apache benchmark tool (already installed on your Mac):
// $ ab -n 1000 -c 1 http://localhost:<port>/some_path.html
- return [[[HTTPConfig alloc] initWithServer:self documentRoot:documentRoot queue:connectionQueue] autorelease];
+ return [[HTTPConfig alloc] initWithServer:self documentRoot:documentRoot queue:connectionQueue];
}
- (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket
@@ -574,7 +540,6 @@ - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSo
[connectionsLock unlock];
[newConnection start];
- [newConnection release];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -629,7 +594,6 @@ - (void)unpublishBonjour
dispatch_block_t bonjourBlock = ^{
[theNetService stop];
- [theNetService release];
};
[[self class] performBonjourBlock:bonjourBlock];
@@ -751,20 +715,24 @@ + (void)startBonjourThreadIfNeeded
+ (void)bonjourThread
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- HTTPLogVerbose(@"%@: BonjourThread: Started", THIS_FILE);
-
- // We can't run the run loop unless it has an associated input source or a timer.
- // So we'll just create a timer that will never fire - unless the server runs for 10,000 years.
-
- [NSTimer scheduledTimerWithTimeInterval:DBL_MAX target:self selector:@selector(ignore:) userInfo:nil repeats:YES];
+ @autoreleasepool {
- [[NSRunLoop currentRunLoop] run];
-
- HTTPLogVerbose(@"%@: BonjourThread: Aborted", THIS_FILE);
+ HTTPLogVerbose(@"%@: BonjourThread: Started", THIS_FILE);
+
+ // We can't run the run loop unless it has an associated input source or a timer.
+ // So we'll just create a timer that will never fire - unless the server runs for 10,000 years.
+
+ [NSTimer scheduledTimerWithTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow]
+ target:self
+ selector:@selector(donothingatall:)
+ userInfo:nil
+ repeats:YES];
+
+ [[NSRunLoop currentRunLoop] run];
+
+ HTTPLogVerbose(@"%@: BonjourThread: Aborted", THIS_FILE);
- [pool drain];
+ }
}
+ (void)executeBonjourBlock:(dispatch_block_t)block
View
11 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPAsyncFileResponse.m
@@ -5,6 +5,10 @@
#import <unistd.h>
#import <fcntl.h>
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels : off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -44,7 +48,6 @@ - (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent
{
HTTPLogWarn(@"%@: Init failed - Nil filePath", THIS_FILE);
- [self release];
return nil;
}
@@ -53,7 +56,6 @@ - (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent
{
HTTPLogWarn(@"%@: Init failed - Unable to get file attributes. filePath: %@", THIS_FILE, filePath);
- [self release];
return nil;
}
@@ -320,7 +322,7 @@ - (NSData *)readDataOfLength:(NSUInteger)length
NSData *result = data;
data = nil;
- return [result autorelease];
+ return result;
}
else
{
@@ -394,10 +396,7 @@ - (void)dealloc
if (readBuffer)
free(readBuffer);
- [filePath release];
- [data release];
- [super dealloc];
}
@end
View
8 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPDataResponse.m
@@ -1,6 +1,10 @@
#import "HTTPDataResponse.h"
#import "HTTPLogging.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels : off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_OFF; // | HTTP_LOG_FLAG_TRACE;
@@ -15,7 +19,7 @@ - (id)initWithData:(NSData *)dataParam
HTTPLogTrace();
offset = 0;
- data = [dataParam retain];
+ data = dataParam;
}
return self;
}
@@ -24,8 +28,6 @@ - (void)dealloc
{
HTTPLogTrace();
- [data release];
- [super dealloc];
}
- (UInt64)contentLength
View
12 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPDynamicFileResponse.m
@@ -2,6 +2,10 @@
#import "HTTPConnection.h"
#import "HTTPLogging.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels : off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -20,8 +24,8 @@ - (id)initWithFilePath:(NSString *)fpath
{
HTTPLogTrace();
- separator = [[separatorStr dataUsingEncoding:NSUTF8StringEncoding] retain];
- replacementDict = [dict retain];
+ separator = [separatorStr dataUsingEncoding:NSUTF8StringEncoding];
+ replacementDict = dict;
}
return self;
}
@@ -212,7 +216,6 @@ - (void)processReadBuffer
}
}
- [key release];
}
found1 = found2 = NO;
@@ -283,10 +286,7 @@ - (void)dealloc
{
HTTPLogTrace();
- [separator release];
- [replacementDict release];
- [super dealloc];
}
@end
View
8 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPFileResponse.m
@@ -5,6 +5,10 @@
#import <unistd.h>
#import <fcntl.h>
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels : off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -28,7 +32,6 @@ - (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent
{
HTTPLogWarn(@"%@: Init failed - Nil filePath", THIS_FILE);
- [self release];
return nil;
}
@@ -37,7 +40,6 @@ - (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent
{
HTTPLogWarn(@"%@: Init failed - Unable to get file attributes. filePath: %@", THIS_FILE, filePath);
- [self release];
return nil;
}
@@ -230,8 +232,6 @@ - (void)dealloc
if (buffer)
free(buffer);
- [filePath release];
- [super dealloc];
}
@end
View
6 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/Responses/HTTPRedirectResponse.m
@@ -1,6 +1,10 @@
#import "HTTPRedirectResponse.h"
#import "HTTPLogging.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels : off, error, warn, info, verbose
// Other flags: trace
static const int httpLogLevel = HTTP_LOG_LEVEL_OFF; // | HTTP_LOG_FLAG_TRACE;
@@ -64,8 +68,6 @@ - (void)dealloc
{
HTTPLogTrace();
- [redirectPath release];
- [super dealloc];
}
@end
View
4 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/WebSocket.h
@@ -19,7 +19,7 @@
BOOL isOpen;
BOOL isVersion76;
- id delegate;
+ id __unsafe_unretained delegate;
}
+ (BOOL)isWebSocketRequest:(HTTPMessage *)request;
@@ -32,7 +32,7 @@
* In most cases it will be easier to subclass WebSocket,
* but some circumstances may lead one to prefer standard delegate callbacks instead.
**/
-@property (/* atomic */ assign) id delegate;
+@property (/* atomic */ unsafe_unretained) id delegate;
/**
* The WebSocket class is thread-safe, generally via it's GCD queue.
View
35 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/WebSocket.m
@@ -5,6 +5,10 @@
#import "DDData.h"
#import "HTTPLogging.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
// Log levels: off, error, warn, info, verbose
// Other flags : trace
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -114,7 +118,6 @@ - (id)initWithRequest:(HTTPMessage *)aRequest socket:(GCDAsyncSocket *)socket
if (aRequest == nil)
{
- [self release];
return nil;
}
@@ -126,13 +129,12 @@ - (id)initWithRequest:(HTTPMessage *)aRequest socket:(GCDAsyncSocket *)socket
NSString *temp = [[NSString alloc] initWithData:requestHeaders encoding:NSUTF8StringEncoding];
HTTPLogVerbose(@"%@[%p] Request Headers:\n%@", THIS_FILE, self, temp);
- [temp release];
}
websocketQueue = dispatch_queue_create("WebSocket", NULL);
- request = [aRequest retain];
+ request = aRequest;
- asyncSocket = [socket retain];
+ asyncSocket = socket;
[asyncSocket setDelegate:self delegateQueue:websocketQueue];
isOpen = NO;
@@ -149,13 +151,10 @@ - (void)dealloc
dispatch_release(websocketQueue);
- [request release];
[asyncSocket setDelegate:nil delegateQueue:NULL];
[asyncSocket disconnect];
- [asyncSocket release];
- [super dealloc];
}
- (id)delegate
@@ -189,8 +188,7 @@ - (void)start
// This method is not exactly designed to be overriden.
// Subclasses are encouraged to override the didOpen method instead.
- dispatch_async(websocketQueue, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_async(websocketQueue, ^{ @autoreleasepool {
if (isStarted) return;
isStarted = YES;
@@ -204,9 +202,7 @@ - (void)start
[self sendResponseHeaders];
[self didOpen];
}
-
- [pool drain];
- });
+ }});
}
/**
@@ -218,13 +214,10 @@ - (void)stop
// This method is not exactly designed to be overriden.
// Subclasses are encouraged to override the didClose method instead.
- dispatch_async(websocketQueue, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_async(websocketQueue, ^{ @autoreleasepool {
[asyncSocket disconnect];
-
- [pool drain];
- });
+ }});
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -360,13 +353,11 @@ - (void)sendResponseHeaders
NSData *responseHeaders = [wsResponse messageData];
- [wsResponse release];
if (HTTP_LOG_VERBOSE)
{
NSString *temp = [[NSString alloc] initWithData:responseHeaders encoding:NSUTF8StringEncoding];
HTTPLogVerbose(@"%@[%p] Response Headers:\n%@", THIS_FILE, self, temp);
- [temp release];
}
[asyncSocket writeData:responseHeaders withTimeout:TIMEOUT_NONE tag:TAG_HTTP_RESPONSE_HEADERS];
@@ -461,11 +452,6 @@ - (void)sendResponseBody:(NSData *)d3
HTTPLogVerbose(@"key0 concat : raw(%@) str(%@)", d0, s0);
HTTPLogVerbose(@"responseBody: raw(%@) str(%@)", responseBody, sH);
- [s1 release];
- [s2 release];
- [s3 release];
- [s0 release];
- [sH release];
}
}
@@ -581,7 +567,6 @@ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)t
[self didReceiveMessage:msg];
- [msg release];
// Read next message
[asyncSocket readDataToLength:1 withTimeout:TIMEOUT_NONE tag:TAG_PREFIX];
View
36 Xcode/WebServerIPhone/WebServerIPhone.xcodeproj/project.pbxproj
@@ -27,20 +27,20 @@
DCA67D9D146B4D7D003411EE /* ContextFilterLogFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67D94146B4D7D003411EE /* ContextFilterLogFormatter.m */; };
DCA67D9E146B4D7D003411EE /* DispatchQueueLogFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67D96146B4D7D003411EE /* DispatchQueueLogFormatter.m */; };
DCA67D9F146B4D7D003411EE /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = DCA67D97146B4D7D003411EE /* README.txt */; };
- DCA67DBF146B4DB4003411EE /* DDData.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA3146B4DB4003411EE /* DDData.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC0146B4DB4003411EE /* DDNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA5146B4DB4003411EE /* DDNumber.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC1146B4DB4003411EE /* DDRange.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA7146B4DB4003411EE /* DDRange.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC2146B4DB4003411EE /* HTTPAuthenticationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA9146B4DB4003411EE /* HTTPAuthenticationRequest.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC3146B4DB4003411EE /* HTTPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DAB146B4DB4003411EE /* HTTPConnection.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC4146B4DB4003411EE /* HTTPMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DAE146B4DB4003411EE /* HTTPMessage.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC5146B4DB4003411EE /* HTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB1146B4DB4003411EE /* HTTPServer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC6146B4DB4003411EE /* HTTPAsyncFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB4146B4DB4003411EE /* HTTPAsyncFileResponse.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC7146B4DB4003411EE /* HTTPDataResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB6146B4DB4003411EE /* HTTPDataResponse.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC8146B4DB4003411EE /* HTTPDynamicFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB8146B4DB4003411EE /* HTTPDynamicFileResponse.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DC9146B4DB4003411EE /* HTTPFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DBA146B4DB4003411EE /* HTTPFileResponse.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DCA146B4DB4003411EE /* HTTPRedirectResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DBC146B4DB4003411EE /* HTTPRedirectResponse.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DCB146B4DB4003411EE /* WebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DBE146B4DB4003411EE /* WebSocket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
- DCA67DCF146B4E3C003411EE /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DCE146B4E3C003411EE /* GCDAsyncSocket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ DCA67DBF146B4DB4003411EE /* DDData.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA3146B4DB4003411EE /* DDData.m */; };
+ DCA67DC0146B4DB4003411EE /* DDNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA5146B4DB4003411EE /* DDNumber.m */; };
+ DCA67DC1146B4DB4003411EE /* DDRange.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA7146B4DB4003411EE /* DDRange.m */; };
+ DCA67DC2146B4DB4003411EE /* HTTPAuthenticationRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DA9146B4DB4003411EE /* HTTPAuthenticationRequest.m */; };
+ DCA67DC3146B4DB4003411EE /* HTTPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DAB146B4DB4003411EE /* HTTPConnection.m */; };
+ DCA67DC4146B4DB4003411EE /* HTTPMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DAE146B4DB4003411EE /* HTTPMessage.m */; };
+ DCA67DC5146B4DB4003411EE /* HTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB1146B4DB4003411EE /* HTTPServer.m */; };
+ DCA67DC6146B4DB4003411EE /* HTTPAsyncFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB4146B4DB4003411EE /* HTTPAsyncFileResponse.m */; };
+ DCA67DC7146B4DB4003411EE /* HTTPDataResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB6146B4DB4003411EE /* HTTPDataResponse.m */; };
+ DCA67DC8146B4DB4003411EE /* HTTPDynamicFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DB8146B4DB4003411EE /* HTTPDynamicFileResponse.m */; };
+ DCA67DC9146B4DB4003411EE /* HTTPFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DBA146B4DB4003411EE /* HTTPFileResponse.m */; };
+ DCA67DCA146B4DB4003411EE /* HTTPRedirectResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DBC146B4DB4003411EE /* HTTPRedirectResponse.m */; };
+ DCA67DCB146B4DB4003411EE /* WebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DBE146B4DB4003411EE /* WebSocket.m */; };
+ DCA67DCF146B4E3C003411EE /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = DCA67DCE146B4E3C003411EE /* GCDAsyncSocket.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -397,13 +397,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;