@@ -45,11 +45,11 @@ * FIXME: Key normalization replaces headers like "DNT" with "Dnt". * FIXME: Errors are not reported to the user. */ @interface OFHTTPServer () -- (bool)of_socket: (OFTCPSocket *)socket +- (bool)of_socket: (OFTCPSocket *)sock didAcceptSocket: (OFTCPSocket *)clientSocket exception: (OFException *)exception; @end static const char * @@ -177,24 +177,24 @@ OFHTTPServer *_server; OFHTTPRequest *_request; bool _chunked, _headersSent; } -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request; @end @implementation OFHTTPServerResponse -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request { self = [super init]; _statusCode = 500; - _socket = [socket retain]; + _socket = [sock retain]; _server = [server retain]; _request = [request retain]; return self; } @@ -336,37 +336,37 @@ OFMutableDictionary *_headers; size_t _contentLength; OFMutableData *_body; } -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line exception: (OFException *)exception; - (bool)parseProlog: (OFString *)line; - (bool)parseHeaders: (OFString *)line; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length exception: (OFException *)exception; - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @implementation OFHTTPServer_Connection -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server { self = [super init]; @try { - _socket = [socket retain]; + _socket = [sock retain]; _server = [server retain]; _timer = [[OFTimer scheduledTimerWithTimeInterval: 10 - target: socket + target: _socket selector: @selector( cancelAsyncRequests) repeats: false] retain]; _state = AWAITING_PROLOG; } @catch (id e) { @@ -391,11 +391,11 @@ [_body release]; [super dealloc]; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line exception: (OFException *)exception { if (line == nil || exception != nil) return false; @@ -567,16 +567,16 @@ } return true; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length exception: (OFException *)exception { - if ([socket isAtEndOfStream] || exception != nil) + if ([sock isAtEndOfStream] || exception != nil) return false; [_body addItems: buffer count: length]; @@ -731,11 +731,11 @@ [_listeningSocket cancelAsyncRequests]; [_listeningSocket release]; _listeningSocket = nil; } -- (bool)of_socket: (OFTCPSocket *)socket +- (bool)of_socket: (OFTCPSocket *)sock didAcceptSocket: (OFTCPSocket *)clientSocket exception: (OFException *)exception { OFHTTPServer_Connection *connection;