@@ -57,25 +57,25 @@ @interface OFHTTPServer () @end @interface OFHTTPServerResponse: OFHTTPResponse { - OFTCPSocket *_socket; + OFStreamSocket *_socket; OFHTTPServer *_server; OFHTTPRequest *_request; bool _chunked, _headersSent; } -- (instancetype)initWithSocket: (OFTCPSocket *)sock +- (instancetype)initWithSocket: (OFStreamSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request; @end @interface OFHTTPServerConnection: OFObject { @public - OFTCPSocket *_socket; + OFStreamSocket *_socket; OFHTTPServer *_server; OFTimer *_timer; enum { AWAITING_PROLOG, PARSING_HEADERS, @@ -88,27 +88,27 @@ OFMutableDictionary *_headers; size_t _contentLength; OFStream *_requestBody; } -- (instancetype)initWithSocket: (OFTCPSocket *)sock +- (instancetype)initWithSocket: (OFStreamSocket *)sock server: (OFHTTPServer *)server; - (bool)parseProlog: (OFString *)line; - (bool)parseHeaders: (OFString *)line; - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @interface OFHTTPServerRequestBodyStream: OFStream { - OFTCPSocket *_socket; + OFStreamSocket *_socket; bool _chunked; intmax_t _toRead; bool _atEndOfStream, _setAtEndOfStream; } -- (instancetype)initWithSocket: (OFTCPSocket *)sock +- (instancetype)initWithSocket: (OFStreamSocket *)sock chunked: (bool)chunked contentLength: (uintmax_t)contentLength; @end #ifdef OF_HAVE_THREADS @@ -146,11 +146,11 @@ return [OFString stringWithUTF8StringNoCopy: cString freeWhenDone: true]; } @implementation OFHTTPServerResponse -- (instancetype)initWithSocket: (OFTCPSocket *)sock +- (instancetype)initWithSocket: (OFStreamSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request { self = [super init]; @@ -281,11 +281,11 @@ return _socket.fileDescriptorForWriting; } @end @implementation OFHTTPServerConnection -- (instancetype)initWithSocket: (OFTCPSocket *)sock +- (instancetype)initWithSocket: (OFStreamSocket *)sock server: (OFHTTPServer *)server { self = [super init]; @try { @@ -577,11 +577,11 @@ objc_autoreleasePoolPop(pool); } @end @implementation OFHTTPServerRequestBodyStream -- (instancetype)initWithSocket: (OFTCPSocket *)sock +- (instancetype)initWithSocket: (OFStreamSocket *)sock chunked: (bool)chunked contentLength: (uintmax_t)contentLength { self = [super init]; @@ -974,22 +974,22 @@ [_threadPool release]; _threadPool = nil; #endif } -- (void)of_handleAcceptedSocket: (OFTCPSocket *)acceptedSocket +- (void)of_handleAcceptedSocket: (OFStreamSocket *)acceptedSocket { OFHTTPServerConnection *connection = [[[OFHTTPServerConnection alloc] initWithSocket: acceptedSocket server: self] autorelease]; acceptedSocket.delegate = connection; [acceptedSocket asyncReadLine]; } -- (bool)socket: (OFTCPSocket *)sock - didAcceptSocket: (OFTCPSocket *)acceptedSocket +- (bool)socket: (OFStreamSocket *)sock + didAcceptSocket: (OFStreamSocket *)acceptedSocket exception: (id)exception { if (exception != nil) { if (![_delegate respondsToSelector: @selector(server:didReceiveExceptionOnListeningSocket:)])