ObjFW  Diff

Differences From Artifact [b9f96c6e08]:

To Artifact [e4b33c27ce]:


20
21
22
23
24
25
26


27
28
29
30
31
32
33
34
35
36
37
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
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89




90
91
92
93
94
95
96






97
98
99
100
101
102
103

104
105
106
107





108
109
110
111
112
113





114

115
116
117
118
119
120
121

122
123
124




125
126
127
128
129
130
131






132
133
134
135
136
137
138
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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


74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105


106
107
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
154
155
156


157
158
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175
176
177
178
179







+
+


















+

-
-
-
+
+
+
+






+
+
+
+
+
-
+







+

-
-
+
+
+
+






-
+
+
+
+
+
+














+

-
-
+
+
+
+






-
+
+
+
+
+
+







+

-
-
-
+
+
+
+
+






+
+
+
+
+
-
+







+

-
-
+
+
+
+






-
+
+
+
+
+
+







#import "OFArray.h"
#import "OFNumber.h"
#import "OFString.h"
#import "OFURL+Private.h"

#import "OFInvalidFormatException.h"

extern void of_url_verify_escaped(OFString *, OFCharacterSet *);

@implementation OFMutableURL
@dynamic scheme, URLEncodedScheme, host, URLEncodedHost, port, user;
@dynamic URLEncodedUser, password, URLEncodedPassword, path, URLEncodedPath;
@dynamic pathComponents, query, URLEncodedQuery, fragment, URLEncodedFragment;

+ (instancetype)URL
{
	return [[[self alloc] init] autorelease];
}

- (instancetype)init
{
	return [super of_init];
}

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

	[self setURLEncodedScheme:
	    [scheme stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLSchemeAllowedCharacterSet]]];
	_URLEncodedScheme = [[scheme stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLSchemeAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedScheme: (OFString *)URLEncodedScheme
{
	OFString *old;

	of_url_verify_escaped(URLEncodedScheme,
	    [OFCharacterSet URLSchemeAllowedCharacterSet]);

	OFString *old = _URLEncodedScheme;
	old = _URLEncodedScheme;
	_URLEncodedScheme = [URLEncodedScheme copy];
	[old release];
}

- (void)setHost: (OFString *)host
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _URLEncodedHost;

	[self setURLEncodedHost: [host stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLHostAllowedCharacterSet]]];
	_URLEncodedHost = [[host stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLHostAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedHost: (OFString *)URLEncodedHost
{
	OFString *old = _URLEncodedHost;
	OFString *old;

	of_url_verify_escaped(URLEncodedHost,
	    [OFCharacterSet URLHostAllowedCharacterSet]);

	old = _URLEncodedHost;
	_URLEncodedHost = [URLEncodedHost copy];
	[old release];
}

- (void)setPort: (OFNumber *)port
{
	OFNumber *old = _port;
	_port = [port copy];
	[old release];
}

- (void)setUser: (OFString *)user
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _URLEncodedUser;

	[self setURLEncodedUser: [user stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLUserAllowedCharacterSet]]];
	_URLEncodedUser = [[user stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLUserAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedUser: (OFString *)URLEncodedUser
{
	OFString *old = _URLEncodedUser;
	OFString *old;

	of_url_verify_escaped(URLEncodedUser,
	    [OFCharacterSet URLUserAllowedCharacterSet]);

	old = _URLEncodedUser;
	_URLEncodedUser = [URLEncodedUser copy];
	[old release];
}

- (void)setPassword: (OFString *)password
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _URLEncodedPassword;

	[self setURLEncodedPassword:
	    [password stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLPasswordAllowedCharacterSet]]];
	_URLEncodedPassword = [[password
	    stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLPasswordAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedPassword: (OFString *)URLEncodedPassword
{
	OFString *old;

	of_url_verify_escaped(URLEncodedPassword,
	    [OFCharacterSet URLPasswordAllowedCharacterSet]);

	OFString *old = _URLEncodedPassword;
	old = _URLEncodedPassword;
	_URLEncodedPassword = [URLEncodedPassword copy];
	[old release];
}

- (void)setPath: (OFString *)path
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _URLEncodedPath;

	[self setURLEncodedPath: [path stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLPathAllowedCharacterSet]]];
	_URLEncodedPath = [[path stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLPathAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedPath: (OFString *)URLEncodedPath
{
	OFString *old = _URLEncodedPath;
	OFString *old;

	of_url_verify_escaped(URLEncodedPath,
	    [OFCharacterSet URLPathAllowedCharacterSet]);

	old = _URLEncodedPath;
	_URLEncodedPath = [URLEncodedPath copy];
	[old release];
}

- (void)setPathComponents: (OFArray *)components
{
	void *pool = objc_autoreleasePoolPush();
152
153
154
155
156
157
158

159
160
161
162




163
164
165
166
167
168
169






170
171
172
173
174
175
176

177
178
179
180





181
182
183
184
185
186





187

188
189
190
191
192
193
194
193
194
195
196
197
198
199
200
201



202
203
204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250







+

-
-
-
+
+
+
+






-
+
+
+
+
+
+







+

-
-
-
+
+
+
+
+






+
+
+
+
+
-
+








	objc_autoreleasePoolPop(pool);
}

- (void)setQuery: (OFString *)query
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _URLEncodedQuery;

	[self setURLEncodedQuery:
	    [query stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLQueryAllowedCharacterSet]]];
	_URLEncodedQuery = [[query stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLQueryAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedQuery: (OFString *)URLEncodedQuery
{
	OFString *old = _URLEncodedQuery;
	OFString *old;

	of_url_verify_escaped(URLEncodedQuery,
	    [OFCharacterSet URLQueryAllowedCharacterSet]);

	old = _URLEncodedQuery;
	_URLEncodedQuery = [URLEncodedQuery copy];
	[old release];
}

- (void)setFragment: (OFString *)fragment
{
	void *pool = objc_autoreleasePoolPush();
	OFString *old = _URLEncodedFragment;

	[self setURLEncodedFragment:
	    [fragment stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLFragmentAllowedCharacterSet]]];
	_URLEncodedFragment = [[fragment
	    stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLFragmentAllowedCharacterSet]] copy];

	[old release];

	objc_autoreleasePoolPop(pool);
}

- (void)setURLEncodedFragment: (OFString *)URLEncodedFragment
{
	OFString *old;

	of_url_verify_escaped(URLEncodedFragment,
	    [OFCharacterSet URLFragmentAllowedCharacterSet]);

	OFString *old = _URLEncodedFragment;
	old = _URLEncodedFragment;
	_URLEncodedFragment = [URLEncodedFragment copy];
	[old release];
}

- (id)copy
{
	OFMutableURL *copy = [self mutableCopy];