Overview
Comment: | OFURL: URL-encode according to RFC 3986
This also means the parameters go away and get folded into the path. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5f7305c65925d7c61225422fe0a8db59 |
User & Date: | js on 2017-10-31 21:39:36 |
Other Links: | manifest | tags |
Context
2017-10-31
| ||
21:55 | OFString+URLEncoding: Change default allowed chars check-in: 4db6713bda user: js tags: trunk | |
21:39 | OFURL: URL-encode according to RFC 3986 check-in: 5f7305c659 user: js tags: trunk | |
2017-10-30
| ||
00:29 | Fix nullable properties in Doxygen check-in: 06a922c912 user: js tags: trunk | |
Changes
Modified src/OFMutableURL.h from [db8fdd5d15] to [716b3b017c].
︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - - - - - - | * The path of the URL split into components. * * The first component must always be empty to designate the root. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFArray OF_GENERIC(OFString *) *pathComponents; |
︙ |
Modified src/OFMutableURL.m from [6d9eb70d6a] to [f6b587c9bc].
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | - - + + | #import "OFNumber.h" #import "OFString.h" #import "OFURL+Private.h" #import "OFInvalidFormatException.h" @implementation OFMutableURL |
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | - - - - - - - | @throw [OFInvalidFormatException exception]; [self setPath: [components componentsJoinedByString: @"/"]]; objc_autoreleasePoolPop(pool); } |
︙ |
Modified src/OFURL.h from [cb95b72aba] to [a6d37c0b2c].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | - - + | * @brief A class for parsing URLs and accessing parts of it. */ @interface OFURL: OFObject <OFCopying, OFMutableCopying, OFSerialization> { OFString *_Nullable _scheme, *_Nullable _host; OFNumber *_Nullable _port; OFString *_Nullable _user, *_Nullable _password, *_path; |
︙ | |||
79 80 81 82 83 84 85 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - - - - - | * The last path component of the URL. * * Returns the empty string if the path is the root. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *lastPathComponent; |
︙ |
Modified src/OFURL.m from [48d985e9ad] to [45850285e0].
︙ | |||
168 169 170 171 172 173 174 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - - - - - - - | if ((tmp = strchr(UTF8String, '?')) != NULL) { *tmp = '\0'; _query = [[[OFString stringWithUTF8String: tmp + 1] stringByURLDecoding] copy]; } |
︙ | |||
232 233 234 235 236 237 238 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - - - - - - | if ((tmp = strchr(UTF8String, '?')) != NULL) { *tmp = '\0'; _query = [[[OFString stringWithUTF8String: tmp + 1] stringByURLDecoding] copy]; } |
︙ | |||
348 349 350 351 352 353 354 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | - | { [_scheme release]; [_host release]; [_port release]; [_user release]; [_password release]; [_path release]; |
︙ | |||
376 377 378 379 380 381 382 | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - - - - | return false; if (URL->_user != _user && ![URL->_user isEqual: _user]) return false; if (URL->_password != _password && ![URL->_password isEqual: _password]) return false; if (URL->_path != _path && ![URL->_path isEqual: _path]) return false; |
︙ | |||
483 484 485 486 487 488 489 | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | - - - - - | length: length - (lastComponent - UTF8String)]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } |
︙ | |||
514 515 516 517 518 519 520 | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | - | @try { [copy setScheme: _scheme]; [copy setHost: _host]; [copy setPort: _port]; [copy setUser: _user]; [copy setPassword: _password]; [copy setPath: _path]; |
︙ | |||
549 550 551 552 553 554 555 | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | - + + - - - - + + + - + + + | [ret appendFormat: @":%@", _port]; if (_path != nil) { if (![_path hasPrefix: @"/"]) @throw [OFInvalidFormatException exception]; [ret appendString: [_path |
︙ |
Modified tests/OFURLTests.m from [9dd7664004] to [96f3992920].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | #import "OFInvalidFormatException.h" #import "TestsAppDelegate.h" static OFString *module = @"OFURL"; static OFString *url_str = @"ht%3Atp://us%3Aer:p%40w@ho%3Ast:1234/" |
︙ | |||
76 77 78 79 80 81 82 | 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 | - + - + - - | 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] isEqual: [OFNumber numberWithUInt16: 1234]]) TEST(@"-[path]", |
︙ |
Modified tests/serialization.xml from [9ca884a2b7] to [4a5293ca90].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + + + + + + + + + + + + + + + + + + + | <?xml version='1.0' encoding='UTF-8'?> <serialization xmlns='https://webkeks.org/objfw/serialization' version='1'> <OFMutableDictionary> <key> <OFString>Blub</OFString> </key> <object> <OFString>B"la</OFString> </object> <key> <OFData>MDEyMzQ1Njc4OTo7PEFCQ0RFRkdISklLTE1OT1BRUlNUVVZXWFla</OFData> </key> <object> <OFString>data</OFString> </object> <key> <OFArray> <OFString>Qu"xbar test</OFString> <OFNumber type='signed'>1234</OFNumber> <OFNumber type='double'>40934a456d5cfaad</OFNumber> <OFMutableString>asd</OFMutableString> <OFDate>40934a456d5cfaad</OFDate> </OFArray> </key> <object> <OFString>Hello</OFString> </object> <key> <OFList> <OFString>Hello</OFString> <OFString>Wo
ld! How are you?</OFString> <OFURL>https://webkeks.org/</OFURL> <OFXMLElement name='x'> |
︙ | |||
34 35 36 37 38 39 40 | 53 54 55 56 57 58 59 60 61 | - - - - - - - - - - - - - - - - - - - | </object> </OFCountedSet> </OFList> </key> <object> <OFString>list</OFString> </object> |