Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -35,18 +35,20 @@ OFURL *URL; of_http_request_type_t requestType; OFDictionary *headers; OFDataArray *POSTData; OFString *MIMEType; + OFString *remoteAddress; } #ifdef OF_HAVE_PROPERTIES @property (copy) OFURL *URL; @property of_http_request_type_t requestType; @property (copy) OFDictionary *headers; @property (retain) OFDataArray *POSTData; @property (copy) OFString *MIMEType; +@property (copy) OFString *remoteAddress; #endif /*! * @brief Creates a new OFHTTPRequest. * @@ -137,10 +139,24 @@ * @brief Returns the MIME type for the POST data. * * @return The MIME type for the POST data */ - (OFString*)MIMEType; + +/*! + * @brief Sets the remote address from which the request originates. + * + * @param remoteAddress The remote address from which the request originates + */ +- (void)setRemoteAddress: (OFString*)remoteAddress; + +/*! + * @brief Returns the remote address from which the request originates. + * + * @return The remote address from which the request originates + */ +- (OFString*)remoteAddress; @end /*! * @brief A class for storing the result of an HTTP request. */ Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -116,10 +116,20 @@ - (OFString*)MIMEType { OF_GETTER(MIMEType, YES) } + +- (void)setRemoteAddress: (OFString*)remoteAddress_ +{ + OF_SETTER(remoteAddress, remoteAddress_, YES, 1) +} + +- (OFString*)remoteAddress +{ + OF_GETTER(remoteAddress, YES) +} - (OFString*)description { void *pool = objc_autoreleasePoolPush(); const char *requestTypeStr = NULL; @@ -148,13 +158,14 @@ @"<%@:\n\tURL = %@\n" @"\tRequest type = %s\n" @"\tHeaders = %@\n" @"\tPOST data = %@\n" @"\tPOST data MIME type = %@\n" + @"\tRemote address = %@\n" @">", [self class], URL, requestTypeStr, indentedHeaders, - indentedPOSTData, MIMEType]; + indentedPOSTData, MIMEType, remoteAddress]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -462,10 +462,11 @@ request = [OFHTTPRequest requestWithURL: URL]; [request setRequestType: requestType]; [request setHeaders: headers]; [request setPOSTData: POSTData]; + [request setRemoteAddress: [sock remoteAddress]]; reply = [[server delegate] server: server didReceiveRequest: request]; if (reply == nil) {