Index: src/OFMutableURL.h ================================================================== --- src/OFMutableURL.h +++ src/OFMutableURL.h @@ -60,16 +60,10 @@ * The first component must always be empty to designate the root. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFArray OF_GENERIC(OFString *) *pathComponents; -/*! - * The parameters part of the URL. - */ -@property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) - OFString *parameters; - /*! * The query part of the URL. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *query; Index: src/OFMutableURL.m ================================================================== --- src/OFMutableURL.m +++ src/OFMutableURL.m @@ -23,12 +23,12 @@ #import "OFURL+Private.h" #import "OFInvalidFormatException.h" @implementation OFMutableURL -@dynamic scheme, host, port, user, password, path, pathComponents, parameters; -@dynamic query, fragment; +@dynamic scheme, host, port, user, password, path, pathComponents, query; +@dynamic fragment; + (instancetype)URL { return [[[self alloc] init] autorelease]; } @@ -98,17 +98,10 @@ [self setPath: [components componentsJoinedByString: @"/"]]; objc_autoreleasePoolPop(pool); } -- (void)setParameters: (OFString *)parameters -{ - OFString *old = _parameters; - _parameters = [parameters copy]; - [old release]; -} - - (void)setQuery: (OFString *)query { OFString *old = _query; _query = [query copy]; [old release]; Index: src/OFURL.h ================================================================== --- src/OFURL.h +++ src/OFURL.h @@ -31,12 +31,11 @@ @interface OFURL: OFObject { OFString *_Nullable _scheme, *_Nullable _host; OFNumber *_Nullable _port; OFString *_Nullable _user, *_Nullable _password, *_path; - OFString *_Nullable _parameters, *_Nullable _query; - OFString *_Nullable _fragment; + OFString *_Nullable _query, *_Nullable _fragment; } /*! * The scheme part of the URL. */ @@ -81,15 +80,10 @@ * Returns the empty string if the path is the root. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *lastPathComponent; -/*! - * The parameters part of the URL. - */ -@property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *parameters; - /*! * The query part of the URL. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *query; Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -170,17 +170,10 @@ _query = [[[OFString stringWithUTF8String: tmp + 1] stringByURLDecoding] copy]; } - if ((tmp = strchr(UTF8String, ';')) != NULL) { - *tmp = '\0'; - - _parameters = [[[OFString stringWithUTF8String: - tmp + 1] stringByURLDecoding] copy]; - } - UTF8String--; *UTF8String = '/'; _path = [[[OFString stringWithUTF8String: UTF8String] stringByURLDecoding] copy]; @@ -234,16 +227,10 @@ *tmp = '\0'; _query = [[[OFString stringWithUTF8String: tmp + 1] stringByURLDecoding] copy]; } - if ((tmp = strchr(UTF8String, ';')) != NULL) { - *tmp = '\0'; - _parameters = [[[OFString stringWithUTF8String: tmp + 1] - stringByURLDecoding] copy]; - } - if (*UTF8String == '/') _path = [[[OFString stringWithUTF8String: UTF8String] stringByURLDecoding] copy]; else { OFString *path, *s; @@ -350,11 +337,10 @@ [_host release]; [_port release]; [_user release]; [_password release]; [_path release]; - [_parameters release]; [_query release]; [_fragment release]; [super dealloc]; } @@ -378,13 +364,10 @@ return false; if (URL->_password != _password && ![URL->_password isEqual: _password]) return false; if (URL->_path != _path && ![URL->_path isEqual: _path]) return false; - if (URL->_parameters != _parameters && - ![URL->_parameters isEqual: _parameters]) - return false; if (URL->_query != _query && ![URL->_query isEqual: _query]) return false; if (URL->_fragment != _fragment && ![URL->_fragment isEqual: _fragment]) return false; @@ -401,11 +384,10 @@ OF_HASH_ADD_HASH(hash, [_host hash]); OF_HASH_ADD_HASH(hash, [_port hash]); OF_HASH_ADD_HASH(hash, [_user hash]); OF_HASH_ADD_HASH(hash, [_password hash]); OF_HASH_ADD_HASH(hash, [_path hash]); - OF_HASH_ADD_HASH(hash, [_parameters hash]); OF_HASH_ADD_HASH(hash, [_query hash]); OF_HASH_ADD_HASH(hash, [_fragment hash]); OF_HASH_FINALIZE(hash); @@ -485,15 +467,10 @@ objc_autoreleasePoolPop(pool); return [ret autorelease]; } -- (OFString *)parameters -{ - return _parameters; -} - - (OFString *)query { return _query; } @@ -516,11 +493,10 @@ [copy setHost: _host]; [copy setPort: _port]; [copy setUser: _user]; [copy setPassword: _password]; [copy setPath: _path]; - [copy setParameters: _parameters]; [copy setQuery: _query]; [copy setFragment: _fragment]; } @catch (id e) { [copy release]; @throw e; @@ -551,21 +527,23 @@ if (_path != nil) { if (![_path hasPrefix: @"/"]) @throw [OFInvalidFormatException exception]; [ret appendString: [_path - stringByURLEncodingWithAllowedCharacters: "$-_.!*()/"]]; + stringByURLEncodingWithAllowedCharacters: + "-._~!$&'()*+,;=:@/"]]; } - if (_parameters != nil) - [ret appendFormat: @";%@", [_parameters stringByURLEncoding]]; - if (_query != nil) - [ret appendFormat: @"?%@", [_query stringByURLEncoding]]; + [ret appendFormat: @"?%@", + [_query stringByURLEncodingWithAllowedCharacters: + "-._~!$&'()*+,;=:@/?"]]; if (_fragment != nil) - [ret appendFormat: @"#%@", [_fragment stringByURLEncoding]]; + [ret appendFormat: @"#%@", + [_fragment stringByURLEncodingWithAllowedCharacters: + "-._~!$&'()*+,;=:@/?"]]; objc_autoreleasePoolPop(pool); [ret makeImmutable]; Index: tests/OFURLTests.m ================================================================== --- tests/OFURLTests.m +++ tests/OFURLTests.m @@ -29,11 +29,11 @@ #import "TestsAppDelegate.h" static OFString *module = @"OFURL"; static OFString *url_str = @"ht%3Atp://us%3Aer:p%40w@ho%3Ast:1234/" - @"pa%3Bth;pa%3Fram?que%23ry#frag%23ment"; + @"pa%3Fth?que%23ry#frag%23ment"; @implementation TestsAppDelegate (OFURLTests) - (void)URLTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; @@ -78,15 +78,15 @@ TEST(@"-[password]", [[u1 password] isEqual: @"p@w"] && [u4 password] == nil) TEST(@"-[host]", [[u1 host] isEqual: @"ho:st"] && [u4 port] == 0) TEST(@"-[port]", [[u1 port] isEqual: [OFNumber numberWithUInt16: 1234]]) TEST(@"-[path]", - [[u1 path] isEqual: @"/pa;th"] && + [[u1 path] isEqual: @"/pa?th"] && [[u4 path] isEqual: @"/etc/passwd"]) TEST(@"-[pathComponents]", [[u1 pathComponents] isEqual: - [OFArray arrayWithObjects: @"", @"pa;th", nil]] && + [OFArray arrayWithObjects: @"", @"pa?th", nil]] && [[u4 pathComponents] isEqual: [OFArray arrayWithObjects: @"", @"etc", @"passwd", nil]]) TEST(@"-[lastPathComponent", [[[OFURL URLWithString: @"http://host/foo//bar/baz"] lastPathComponent] isEqual: @"baz"] && @@ -94,12 +94,10 @@ lastPathComponent] isEqual: @"baz"] && [[[OFURL URLWithString: @"http://host/foo/"] lastPathComponent] isEqual: @"foo"] && [[[OFURL URLWithString: @"http://host/"] lastPathComponent] isEqual: @""]) - TEST(@"-[parameters]", - [[u1 parameters] isEqual: @"pa?ram"] && [u4 parameters] == nil) TEST(@"-[query]", [[u1 query] isEqual: @"que#ry"] && [u4 query] == nil) TEST(@"-[fragment]", [[u1 fragment] isEqual: @"frag#ment"] && [u4 fragment] == nil) Index: tests/serialization.xml ================================================================== --- tests/serialization.xml +++ tests/serialization.xml @@ -5,10 +5,29 @@ Blub B"la + + MDEyMzQ1Njc4OTo7PEFCQ0RFRkdISklLTE1OT1BRUlNUVVZXWFla + + + data + + + + Qu"xbar +test + 1234 + 40934a456d5cfaad + asd + 40934a456d5cfaad + + + + Hello + Hello Wo ld! How are you? @@ -36,26 +55,7 @@ list - - - Qu"xbar -test - 1234 - 40934a456d5cfaad - asd - 40934a456d5cfaad - - - - Hello - - - MDEyMzQ1Njc4OTo7PEFCQ0RFRkdISklLTE1OT1BRUlNUVVZXWFla - - - data -