ObjFW  Check-in [bdf4b1d37e]

Overview
Comment:OFURL: Fix handling of scheme in -[string]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bdf4b1d37e2e318ae146878e1696618e035ca08cf4cf96ee3fd242e9b5751d38
User & Date: js on 2015-07-02 20:41:29
Other Links: manifest | tags
Context
2015-08-09
14:59
PLATFORMS.md: Add OS X El Capitan check-in: 16db923d91 user: js tags: trunk
2015-07-02
20:41
OFURL: Fix handling of scheme in -[string] check-in: bdf4b1d37e user: js tags: trunk
2015-06-30
20:56
OFURL: Properly handle escaping / unescaping check-in: d94375547e user: js tags: trunk
Changes

Modified src/OFURL.m from [71a208e68b] to [bd2f6100f7].

478
479
480
481
482
483
484
485
486
487



488
489
490
491
492
493
494
478
479
480
481
482
483
484



485
486
487
488
489
490
491
492
493
494







-
-
-
+
+
+







				   [_password stringByURLEncoding]];
	else if (_user != nil)
		[ret appendFormat: @"%@@", [_user stringByURLEncoding]];

	if (_host != nil)
		[ret appendString: [_host stringByURLEncoding]];

	if (([_scheme isEqual: @"http"] && _port != 80) ||
	    ([_scheme isEqual: @"https"] && _port != 443) ||
	    ([_scheme isEqual: @"ftp"] && _port != 21))
	if (!(([_scheme isEqual: @"http"] && _port == 80) ||
	    ([_scheme isEqual: @"https"] && _port == 443) ||
	    ([_scheme isEqual: @"ftp"] && _port == 21)))
		[ret appendFormat: @":%u", _port];

	if (_path != nil)
		[ret appendFormat: @"/%@",
		    [_path stringByURLEncodingWithIgnoredCharacters: "/"]];

	if (_parameters != nil)

Modified tests/OFURLTests.m from [47061d302f] to [ec44f7d01d].

56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70







-
+







	TEST(@"-[string]",
	    [[u1 string] isEqual: url_str] &&
	    [[u2 string] isEqual: @"http://foo"] &&
	    [[u3 string] isEqual: @"http://bar/"] &&
	    [[u4 string] isEqual: @"file:///etc/passwd"])

	TEST(@"-[scheme]",
	    [[u1 scheme] isEqual: @"ht%3Atp"] && [[u4 scheme] isEqual: @"file"])
	    [[u1 scheme] isEqual: @"ht:tp"] && [[u4 scheme] isEqual: @"file"])
	TEST(@"-[user]", [[u1 user] isEqual: @"us:er"] && [u4 user] == nil)
	TEST(@"-[password]",
	    [[u1 password] isEqual: @"p@w"] && [u4 password] == nil)
	TEST(@"-[host]", [[u1 host] isEqual: @"ho:st"] && [u4 port] == 0)
	TEST(@"-[port]", [u1 port] == 1234)
	TEST(@"-[path]",
	    [[u1 path] isEqual: @"pa;th"] &&