@@ -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 context: (id)context exception: (id)exception; @end @@ -178,24 +178,24 @@ OFHTTPServer *_server; OFHTTPRequest *_request; bool _chunked, _headersSent; } -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request; @end @implementation OFHTTPServerResponse -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)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; } @@ -339,39 +339,39 @@ OFMutableDictionary *_headers; size_t _contentLength; OFMutableData *_body; } -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line context: (id)context exception: (id)exception; - (bool)parseProlog: (OFString *)line; - (bool)parseHeaders: (OFString *)line; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length context: (id)context exception: (id)exception; - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @implementation OFHTTPServer_Connection -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)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) { @@ -396,11 +396,11 @@ [_body release]; [super dealloc]; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line context: (id)context exception: (id)exception { if (line == nil || exception != nil) @@ -575,17 +575,17 @@ } return true; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length context: (id)context exception: (id)exception { - if ([socket isAtEndOfStream] || exception != nil) + if ([sock isAtEndOfStream] || exception != nil) return false; [_body addItems: buffer count: length]; @@ -741,11 +741,11 @@ [_listeningSocket cancelAsyncRequests]; [_listeningSocket release]; _listeningSocket = nil; } -- (bool)of_socket: (OFTCPSocket *)socket +- (bool)of_socket: (OFTCPSocket *)sock didAcceptSocket: (OFTCPSocket *)clientSocket context: (id)context exception: (id)exception { OFHTTPServer_Connection *connection;