ObjFW  Check-in [12d95e15ae]

Overview
Comment:OFURI: Enforce scheme starts with a letter
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 12d95e15ae62340aedbda5a3ca3a4aefbd5888e8cfa8e06513cdf60deaca719a
User & Date: js on 2022-10-10 19:22:07
Other Links: manifest | tags
Context
2022-10-10
23:50
Make relative URIs behave as per RFC 3986 check-in: 3b2697b2a7 user: js tags: trunk
19:22
OFURI: Enforce scheme starts with a letter check-in: 12d95e15ae user: js tags: trunk
2022-10-09
21:04
Add VERSIONINFO resource on Windows check-in: 285a384ff4 user: js tags: trunk
Changes

Modified src/OFMutableURI.m from [6f860bcc98] to [81bd62a18e].

38
39
40
41
42
43
44



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59




60
61
62
63
64
65
66
	return [[[self alloc] init] autorelease];
}

- (void)setScheme: (OFString *)scheme
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _percentEncodedScheme;




	_percentEncodedScheme = [[scheme.lowercaseString
	    stringByAddingPercentEncodingWithAllowedCharacters:
	    [OFCharacterSet URISchemeAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setPercentEncodedScheme: (OFString *)percentEncodedScheme
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _percentEncodedScheme;





	if (percentEncodedScheme != nil)
		OFURIVerifyIsEscaped(percentEncodedScheme,
		    [OFCharacterSet URISchemeAllowedCharacterSet]);

	_percentEncodedScheme = [percentEncodedScheme.lowercaseString copy];

	[old release];







>
>
>















>
>
>
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	return [[[self alloc] init] autorelease];
}

- (void)setScheme: (OFString *)scheme
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _percentEncodedScheme;

	if (scheme.length < 1 || !OFASCIIIsAlpha(*scheme.UTF8String))
		@throw [OFInvalidFormatException exception];

	_percentEncodedScheme = [[scheme.lowercaseString
	    stringByAddingPercentEncodingWithAllowedCharacters:
	    [OFCharacterSet URISchemeAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setPercentEncodedScheme: (OFString *)percentEncodedScheme
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _percentEncodedScheme;

	if (percentEncodedScheme.length < 1 ||
	    !OFASCIIIsAlpha(*percentEncodedScheme.UTF8String))
		@throw [OFInvalidFormatException exception];

	if (percentEncodedScheme != nil)
		OFURIVerifyIsEscaped(percentEncodedScheme,
		    [OFCharacterSet URISchemeAllowedCharacterSet]);

	_percentEncodedScheme = [percentEncodedScheme.lowercaseString copy];

	[old release];

Modified src/OFURI.m from [213596bf3e] to [d2aca0a264].

588
589
590
591
592
593
594
595

596
597
598
599
600
601
602

	@try {
		void *pool = objc_autoreleasePoolPush();
		const char *UTF8String = string.UTF8String;
		size_t length = string.UTF8StringLength;
		const char *colon;

		if ((colon = strchr(UTF8String, ':')) == NULL)

			@throw [OFInvalidFormatException exception];

		_percentEncodedScheme = [[[OFString
		    stringWithUTF8String: UTF8String
				  length: colon - UTF8String] lowercaseString]
		    copy];








|
>







588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603

	@try {
		void *pool = objc_autoreleasePoolPush();
		const char *UTF8String = string.UTF8String;
		size_t length = string.UTF8StringLength;
		const char *colon;

		if ((colon = strchr(UTF8String, ':')) == NULL ||
		    colon - UTF8String < 1 || !OFASCIIIsAlpha(UTF8String[0]))
			@throw [OFInvalidFormatException exception];

		_percentEncodedScheme = [[[OFString
		    stringWithUTF8String: UTF8String
				  length: colon - UTF8String] lowercaseString]
		    copy];