Index: src/OFHTTPClient.h ================================================================== --- src/OFHTTPClient.h +++ src/OFHTTPClient.h @@ -89,19 +89,20 @@ /*! * @brief A callback which is called when an OFHTTPClient wants to send the * body for a request. * * @param client The OFHTTPClient that wants to send the body - * @param body A stream into which the body should be written + * @param requestBody A stream into which the body of the request should be + * written * @param request The request for which the OFHTTPClient wants to send the body * @param context The context object that was passed to * @ref asyncPerformRequest:context: */ -- (void)client: (OFHTTPClient *)client - requestsBody: (OFStream *)body - request: (OFHTTPRequest *)request - context: (nullable id)context; +- (void)client: (OFHTTPClient *)client + wantsRequestBody: (OFStream *)requestBody + request: (OFHTTPRequest *)request + context: (nullable id)context; /*! * @brief A callback which is called when an OFHTTPClient received headers. * * @param client The OFHTTPClient which received the headers Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -574,18 +574,18 @@ } _firstLine = true; if ([[_request headers] objectForKey: @"Content-Length"] != nil) { - OFStream *stream = [[[OFHTTPClientRequestBodyStream alloc] + OFStream *requestBody = [[[OFHTTPClientRequestBodyStream alloc] initWithHandler: self socket: sock] autorelease]; if ([_client->_delegate respondsToSelector: - @selector(client:requestsBody:request:context:)]) + @selector(client:wantsRequestBody:request:context:)]) [_client->_delegate client: _client - requestsBody: stream + wantsRequestBody: requestBody request: _request context: _context]; } else [sock asyncReadLineWithTarget: self @@ -1148,21 +1148,21 @@ didCreateSocket: sock request: request context: context]; } -- (void)client: (OFHTTPClient *)client - requestsBody: (OFStream *)body - request: (OFHTTPRequest *)request - context: (id)context +- (void)client: (OFHTTPClient *)client + wantsRequestBody: (OFStream *)body + request: (OFHTTPRequest *)request + context: (id)context { if ([_delegate respondsToSelector: - @selector(client:requestsBody:request:context:)]) - [_delegate client: client - requestsBody: body - request: request - context: context]; + @selector(client:wantsRequestBody:request:context:)]) + [_delegate client: client + wantsRequestBody: body + request: request + context: context]; } - (void)client: (OFHTTPClient *)client didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers statusCode: (int)statusCode Index: src/OFHTTPServer.h ================================================================== --- src/OFHTTPServer.h +++ src/OFHTTPServer.h @@ -39,16 +39,16 @@ * @brief This method is called when the HTTP server received a request from a * client. * * @param server The HTTP server which received the request * @param request The request the HTTP server received - * @param body A stream to read the body of the request from, if any + * @param requestBody A stream to read the body of the request from, if any * @param response The response the server will send to the client */ - (void)server: (OFHTTPServer *)server didReceiveRequest: (OFHTTPRequest *)request - body: (nullable OFStream *)body + requestBody: (nullable OFStream *)requestBody response: (OFHTTPResponse *)response; @optional /*! * @brief This method is called when the HTTP server's listening socket Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -83,11 +83,11 @@ of_http_request_method_t _method; OFString *_host, *_path; uint16_t _port; OFMutableDictionary *_headers; size_t _contentLength; - OFStream *_body; + OFStream *_requestBody; } - (instancetype)initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server; - (bool)socket: (OFTCPSocket *)sock @@ -400,11 +400,11 @@ [_timer release]; [_host release]; [_path release]; [_headers release]; - [_body release]; + [_requestBody release]; [super dealloc]; } - (bool)socket: (OFTCPSocket *)sock @@ -509,13 +509,13 @@ } if (contentLength < 0) return [self sendErrorAndClose: 400]; - [_body release]; - _body = nil; - _body = [[OFHTTPServerRequestBodyStream alloc] + [_requestBody release]; + _requestBody = nil; + _requestBody = [[OFHTTPServerRequestBodyStream alloc] initWithSocket: _socket contentLength: contentLength]; [_timer invalidate]; [_timer release]; @@ -649,11 +649,11 @@ server: _server request: request] autorelease]; [[_server delegate] server: _server didReceiveRequest: request - body: _body + requestBody: _requestBody response: response]; objc_autoreleasePoolPop(pool); } @end Index: tests/OFHTTPClientTests.m ================================================================== --- tests/OFHTTPClientTests.m +++ tests/OFHTTPClientTests.m @@ -103,14 +103,14 @@ return nil; } @end @implementation TestsAppDelegate (OFHTTPClientTests) -- (void)client: (OFHTTPClient *)client - requestsBody: (OFStream *)body - request: (OFHTTPRequest *)request - context: (id)context +- (void)client: (OFHTTPClient *)client + wantsRequestBody: (OFStream *)body + request: (OFHTTPRequest *)request + context: (id)context { [body writeString: @"Hello"]; } - (void)client: (OFHTTPClient *)client Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -509,14 +509,14 @@ if (_insecure && [sock respondsToSelector: @selector(setCertificateVerificationEnabled:)]) [sock setCertificateVerificationEnabled: false]; } -- (void)client: (OFHTTPClient *)client - requestsBody: (OFStream *)body - request: (OFHTTPRequest *)request - context: (id)context +- (void)client: (OFHTTPClient *)client + wantsRequestBody: (OFStream *)body + request: (OFHTTPRequest *)request + context: (id)context { /* TODO: Do asynchronously and print status */ while (![_body isAtEndOfStream]) { char buffer[4096]; size_t length;