@@ -197,12 +197,13 @@ parameters = [[OFString alloc] initWithCString: tmp + 1]; } - path = [[OFString alloc] initWithCString: str_c]; - } + path = [[OFString alloc] initWithFormat: @"/%s", str_c]; + } else + path = @""; } @catch (id e) { [self release]; @throw e; } @finally { free(str_c2); @@ -252,11 +253,11 @@ parameters = [[OFString alloc] initWithCString: tmp + 1]; } if (*str_c == '/') - path = [[OFString alloc] initWithCString: str_c + 1]; + path = [[OFString alloc] initWithCString: str_c]; else { OFAutoreleasePool *pool; OFString *s; pool = [[OFAutoreleasePool alloc] init]; @@ -437,11 +438,18 @@ return [[path copy] autorelease]; } - (void)setPath: (OFString*)path_ { - OFString *old = path; + OFString *old; + + if (([scheme isEqual: @"http"] || [scheme isEqual: @"https"]) && + ![path_ hasPrefix: @"/"]) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + + old = path; path = [path_ copy]; [old release]; } - (OFString*)parameters @@ -503,12 +511,11 @@ needPort = NO; if (needPort) [desc appendFormat: @":%d", port]; - if (path != nil) - [desc appendFormat: @"/%@", path]; + [desc appendString: path]; if (parameters != nil) [desc appendFormat: @";%@", parameters]; if (query != nil)