@@ -47,10 +47,11 @@ */ @interface OFHTTPServer () - (bool)of_socket: (OFTCPSocket *)socket didAcceptSocket: (OFTCPSocket *)clientSocket + context: (id)context exception: (OFException *)exception; @end static const char * statusCodeToString(short code) @@ -340,16 +341,18 @@ - initWithSocket: (OFTCPSocket *)socket server: (OFHTTPServer *)server; - (bool)socket: (OFTCPSocket *)socket didReadLine: (OFString *)line + context: (id)context exception: (OFException *)exception; - (bool)parseProlog: (OFString *)line; - (bool)parseHeaders: (OFString *)line; - (bool)socket: (OFTCPSocket *)socket didReadIntoBuffer: (char *)buffer length: (size_t)length + context: (id)context exception: (OFException *)exception; - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @@ -393,10 +396,11 @@ [super dealloc]; } - (bool)socket: (OFTCPSocket *)socket didReadLine: (OFString *)line + context: (id)context exception: (OFException *)exception { if (line == nil || exception != nil) return false; @@ -505,11 +509,13 @@ [_socket asyncReadIntoBuffer: buffer length: BUFFER_SIZE target: self selector: @selector(socket: didReadIntoBuffer: - length:exception:)]; + length:context: + exception:) + context: nil]; [_timer setFireDate: [OFDate dateWithTimeIntervalSinceNow: 5]]; return false; } @@ -570,10 +576,11 @@ } - (bool)socket: (OFTCPSocket *)socket didReadIntoBuffer: (char *)buffer length: (size_t)length + context: (id)context exception: (OFException *)exception { if ([socket isAtEndOfStream] || exception != nil) return false; @@ -720,12 +727,13 @@ port: _port]; [_listeningSocket listen]; [_listeningSocket asyncAcceptWithTarget: self selector: @selector(of_socket: - didAcceptSocket: - exception:)]; + didAcceptSocket:context: + exception:) + context: nil]; } - (void)stop { [_listeningSocket cancelAsyncRequests]; @@ -733,10 +741,11 @@ _listeningSocket = nil; } - (bool)of_socket: (OFTCPSocket *)socket didAcceptSocket: (OFTCPSocket *)clientSocket + context: (id)context exception: (OFException *)exception { OFHTTPServer_Connection *connection; if (exception != nil) { @@ -752,10 +761,11 @@ initWithSocket: clientSocket server: self] autorelease]; [clientSocket asyncReadLineWithTarget: connection selector: @selector(socket:didReadLine: - exception:)]; + context:exception:) + context: nil]; return true; } @end