︙ | | |
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
-
-
|
# import "OFFileManager.h"
#endif
#import "OFNumber.h"
#import "OFString.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, queryDictionary, fragment;
@dynamic URLEncodedFragment;
+ (instancetype)URL
|
︙ | | |
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
|
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
|
-
+
-
+
-
+
-
+
|
}
- (void)setURLEncodedScheme: (OFString *)URLEncodedScheme
{
OFString *old;
if (URLEncodedScheme != nil)
of_url_verify_escaped(URLEncodedScheme,
OFURLVerifyEscaped(URLEncodedScheme,
[OFCharacterSet URLSchemeAllowedCharacterSet]);
old = _URLEncodedScheme;
_URLEncodedScheme = [URLEncodedScheme copy];
[old release];
}
- (void)setHost: (OFString *)host
{
void *pool = objc_autoreleasePoolPush();
OFString *old = _URLEncodedHost;
if (of_url_is_ipv6_host(host))
if (OFURLIsIPv6Host(host))
_URLEncodedHost = [[OFString alloc]
initWithFormat: @"[%@]", host];
else
_URLEncodedHost = [[host
stringByURLEncodingWithAllowedCharacters:
[OFCharacterSet URLHostAllowedCharacterSet]] copy];
[old release];
objc_autoreleasePoolPop(pool);
}
- (void)setURLEncodedHost: (OFString *)URLEncodedHost
{
OFString *old;
if ([URLEncodedHost hasPrefix: @"["] &&
[URLEncodedHost hasSuffix: @"]"]) {
if (!of_url_is_ipv6_host([URLEncodedHost substringWithRange:
if (!OFURLIsIPv6Host([URLEncodedHost substringWithRange:
OFRangeMake(1, URLEncodedHost.length - 2)]))
@throw [OFInvalidFormatException exception];
} else if (URLEncodedHost != nil)
of_url_verify_escaped(URLEncodedHost,
OFURLVerifyEscaped(URLEncodedHost,
[OFCharacterSet URLHostAllowedCharacterSet]);
old = _URLEncodedHost;
_URLEncodedHost = [URLEncodedHost copy];
[old release];
}
|
︙ | | |
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
-
+
|
}
- (void)setURLEncodedUser: (OFString *)URLEncodedUser
{
OFString *old;
if (URLEncodedUser != nil)
of_url_verify_escaped(URLEncodedUser,
OFURLVerifyEscaped(URLEncodedUser,
[OFCharacterSet URLUserAllowedCharacterSet]);
old = _URLEncodedUser;
_URLEncodedUser = [URLEncodedUser copy];
[old release];
}
|
︙ | | |
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
-
+
|
}
- (void)setURLEncodedPassword: (OFString *)URLEncodedPassword
{
OFString *old;
if (URLEncodedPassword != nil)
of_url_verify_escaped(URLEncodedPassword,
OFURLVerifyEscaped(URLEncodedPassword,
[OFCharacterSet URLPasswordAllowedCharacterSet]);
old = _URLEncodedPassword;
_URLEncodedPassword = [URLEncodedPassword copy];
[old release];
}
|
︙ | | |
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
-
+
|
}
- (void)setURLEncodedPath: (OFString *)URLEncodedPath
{
OFString *old;
if (URLEncodedPath != nil)
of_url_verify_escaped(URLEncodedPath,
OFURLVerifyEscaped(URLEncodedPath,
[OFCharacterSet URLPathAllowedCharacterSet]);
old = _URLEncodedPath;
_URLEncodedPath = [URLEncodedPath copy];
[old release];
}
|
︙ | | |
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
-
+
|
}
- (void)setURLEncodedQuery: (OFString *)URLEncodedQuery
{
OFString *old;
if (URLEncodedQuery != nil)
of_url_verify_escaped(URLEncodedQuery,
OFURLVerifyEscaped(URLEncodedQuery,
[OFCharacterSet URLQueryAllowedCharacterSet]);
old = _URLEncodedQuery;
_URLEncodedQuery = [URLEncodedQuery copy];
[old release];
}
|
︙ | | |
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
-
+
|
}
- (void)setURLEncodedFragment: (OFString *)URLEncodedFragment
{
OFString *old;
if (URLEncodedFragment != nil)
of_url_verify_escaped(URLEncodedFragment,
OFURLVerifyEscaped(URLEncodedFragment,
[OFCharacterSet URLFragmentAllowedCharacterSet]);
old = _URLEncodedFragment;
_URLEncodedFragment = [URLEncodedFragment copy];
[old release];
}
|
︙ | | |