Differences From Artifact [48d985e9ad]:
- File src/OFURL.m — part of check-in [c1c9443c1a] at 2017-10-29 15:23:36 on branch trunk — OFURL: Properties store unencoded strings now (user: js, size: 13437) [annotate] [blame] [check-ins using]
To Artifact [45850285e0]:
- File
src/OFURL.m
— part of check-in
[5f7305c659]
at
2017-10-31 21:39:36
on branch trunk
— OFURL: URL-encode according to RFC 3986
This also means the parameters go away and get folded into the path. (user: js, size: 12877) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
168 169 170 171 172 173 174 | if ((tmp = strchr(UTF8String, '?')) != NULL) { *tmp = '\0'; _query = [[[OFString stringWithUTF8String: tmp + 1] stringByURLDecoding] copy]; } | < < < < < < < | 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]; } UTF8String--; *UTF8String = '/'; _path = [[[OFString stringWithUTF8String: UTF8String] stringByURLDecoding] copy]; } |
︙ | ︙ | |||
232 233 234 235 236 237 238 | if ((tmp = strchr(UTF8String, '?')) != NULL) { *tmp = '\0'; _query = [[[OFString stringWithUTF8String: tmp + 1] stringByURLDecoding] copy]; } | < < < < < < | 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]; } if (*UTF8String == '/') _path = [[[OFString stringWithUTF8String: UTF8String] stringByURLDecoding] copy]; else { OFString *path, *s; path = [[OFString stringWithUTF8String: UTF8String] |
︙ | ︙ | |||
348 349 350 351 352 353 354 | { [_scheme release]; [_host release]; [_port release]; [_user release]; [_password release]; [_path release]; | < | 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]; [_query release]; [_fragment release]; [super dealloc]; } - (bool)isEqual: (id)object |
︙ | ︙ | |||
376 377 378 379 380 381 382 | 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; | < < < < | 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; if (URL->_query != _query && ![URL->_query isEqual: _query]) return false; if (URL->_fragment != _fragment && ![URL->_fragment isEqual: _fragment]) return false; return true; } - (uint32_t)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, [_scheme hash]); OF_HASH_ADD_HASH(hash, [_host hash]); OF_HASH_ADD_HASH(hash, [_port hash]); OF_HASH_ADD_HASH(hash, [_user hash]); OF_HASH_ADD_HASH(hash, [_password hash]); OF_HASH_ADD_HASH(hash, [_path hash]); OF_HASH_ADD_HASH(hash, [_query hash]); OF_HASH_ADD_HASH(hash, [_fragment hash]); OF_HASH_FINALIZE(hash); return hash; } |
︙ | ︙ | |||
483 484 485 486 487 488 489 | length: length - (lastComponent - UTF8String)]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } | < < < < < | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | length: length - (lastComponent - UTF8String)]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } - (OFString *)query { return _query; } - (OFString *)fragment { |
︙ | ︙ | |||
514 515 516 517 518 519 520 | @try { [copy setScheme: _scheme]; [copy setHost: _host]; [copy setPort: _port]; [copy setUser: _user]; [copy setPassword: _password]; [copy setPath: _path]; | < | 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]; [copy setQuery: _query]; [copy setFragment: _fragment]; } @catch (id e) { [copy release]; @throw e; } |
︙ | ︙ | |||
549 550 551 552 553 554 555 | [ret appendFormat: @":%@", _port]; if (_path != nil) { if (![_path hasPrefix: @"/"]) @throw [OFInvalidFormatException exception]; [ret appendString: [_path | | > < < < | > > | > > | 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 stringByURLEncodingWithAllowedCharacters: "-._~!$&'()*+,;=:@/"]]; } if (_query != nil) [ret appendFormat: @"?%@", [_query stringByURLEncodingWithAllowedCharacters: "-._~!$&'()*+,;=:@/?"]]; if (_fragment != nil) [ret appendFormat: @"#%@", [_fragment stringByURLEncodingWithAllowedCharacters: "-._~!$&'()*+,;=:@/?"]]; objc_autoreleasePoolPop(pool); [ret makeImmutable]; return ret; } |
︙ | ︙ |