@@ -11,10 +11,12 @@ * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ +#define OF_HTTP_SERVER_M + #include "config.h" #include #include #include @@ -29,11 +31,11 @@ #import "OFNumber.h" #import "OFSocket+Private.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFTimer.h" -#import "OFURL.h" +#import "OFURI.h" #import "OFAlreadyConnectedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" @@ -357,11 +359,11 @@ OFMutableString *path; size_t pos; @try { OFString *version = [line - substringWithRange: OFRangeMake(line.length - 9, 9)]; + substringWithRange: OFMakeRange(line.length - 9, 9)]; OFUnichar tmp; if (![version hasPrefix: @" HTTP/1."]) return [self sendErrorAndClose: 505]; @@ -384,11 +386,11 @@ } @catch (OFInvalidArgumentException *e) { return [self sendErrorAndClose: 405]; } @try { - OFRange range = OFRangeMake(pos + 1, line.length - pos - 10); + OFRange range = OFMakeRange(pos + 1, line.length - pos - 10); path = [[[line substringWithRange: range] mutableCopy] autorelease]; } @catch (OFOutOfRangeException *e) { return [self sendErrorAndClose: 400]; @@ -510,11 +512,11 @@ } - (void)createResponse { void *pool = objc_autoreleasePoolPush(); - OFMutableURL *URL; + OFMutableURI *URI; OFHTTPRequest *request; OFHTTPServerResponse *response; size_t pos; [_timer invalidate]; @@ -530,37 +532,36 @@ [_host release]; _host = [_server.host copy]; _port = [_server port]; } - URL = [OFMutableURL URL]; - URL.scheme = @"http"; - URL.host = _host; + URI = [OFMutableURI URIWithScheme: @"http"]; + URI.host = _host; if (_port != 80) - URL.port = [OFNumber numberWithUnsignedShort: _port]; + URI.port = [OFNumber numberWithUnsignedShort: _port]; @try { if ((pos = [_path rangeOfString: @"?"].location) != OFNotFound) { OFString *path, *query; path = [_path substringToIndex: pos]; query = [_path substringFromIndex: pos + 1]; - URL.URLEncodedPath = path; - URL.URLEncodedQuery = query; + URI.percentEncodedPath = path; + URI.percentEncodedQuery = query; } else - URL.URLEncodedPath = _path; + URI.percentEncodedPath = _path; } @catch (OFInvalidFormatException *e) { objc_autoreleasePoolPop(pool); [self sendErrorAndClose: 400]; return; } - [URL makeImmutable]; + [URI makeImmutable]; - request = [OFHTTPRequest requestWithURL: URL]; + request = [OFHTTPRequest requestWithURI: URI]; request.method = _method; request.protocolVersion = (OFHTTPRequestProtocolVersion){ 1, _HTTPMinorVersion }; request.headers = _headers; request.remoteAddress = _socket.remoteAddress;