Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -288,15 +288,16 @@ requestType = OF_HTTP_REQUEST_TYPE_HEAD; else return [self sendErrorAndClose: 501]; @try { - path = [[line substringWithRange: - of_range(pos + 1, [line length] - pos - 10)] retain]; + path = [line substringWithRange: + of_range(pos + 1, [line length] - pos - 10)]; } @catch (OFOutOfRangeException *e) { return [self sendErrorAndClose: 400]; } + path = [[path stringByDeletingEnclosingWhitespaces] retain]; if (![path hasPrefix: @"/"]) return [self sendErrorAndClose: 400]; headers = [[OFMutableDictionary alloc] init]; Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -168,10 +168,13 @@ if ([portString decimalValue] > 65535) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; port = [portString decimalValue]; + + if (port == 0) + port = 80; objc_autoreleasePoolPop(pool); } else { host = [[OFString alloc] initWithUTF8String: UTF8String];