Overview
Comment: | OFURI: Make scheme and path nonnull
This is as per the RFC, which says the scheme and path can never be |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3e455c48393cbcad58a1714e910025a6 |
User & Date: | js on 2022-10-11 19:27:09 |
Other Links: | manifest | tags |
Context
2022-10-14
| ||
16:11 | OFOpenItemFailedException: Improve description check-in: 67b1d67088 user: js tags: trunk | |
2022-10-11
| ||
19:27 | OFURI: Make scheme and path nonnull check-in: 3e455c4839 user: js tags: trunk | |
00:28 | +[URIForFile{ -> Path}:inArchive{ -> WithURI}:] check-in: a8bc0b31d0 user: js tags: trunk | |
Changes
Modified src/OFArchiveURIHandler.m from [99f47b2418] to [010e8050b6].
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | - + - | @end OFURI * OFArchiveURIHandlerURIForFileInArchive(OFString *scheme, OFString *pathInArchive, OFURI *archiveURI) { static OFOnceControl onceControl = OFOnceControlInitValue; |
Modified src/OFHTTPServer.m from [684e137d81] to [e75cf57b42].
︙ | |||
530 531 532 533 534 535 536 | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | - + - | } [_host release]; _host = [_server.host copy]; _port = [_server port]; } |
︙ |
Modified src/OFMutableURI.h from [c01390b76e] to [9400cfdc05].
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + | /** * @brief The scheme part of the URI. * * @throw OFInvalidFormatException The scheme being set is not in the correct * format */ |
︙ | |||
94 95 96 97 98 99 100 | 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 | - + - - + - + | */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedPassword; /** * @brief The path part of the URI. */ |
︙ | |||
170 171 172 173 174 175 176 | 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 195 196 197 | - + + - + + + + + + + + + + | * @throw OFInvalidFormatException The fragment being set is not in the correct * format */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *percentEncodedFragment; /** |
︙ |
Modified src/OFMutableURI.m from [800b8aa913] to [375c07c449].
︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 12 13 14 15 16 17 18 19 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 | + - + - + + + + + + + + + + + + + + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFMutableURI.h" #import "OFURI+Private.h" #import "OFArray.h" #import "OFDictionary.h" #ifdef OF_HAVE_FILES # import "OFFileManager.h" #endif #import "OFNumber.h" #import "OFPair.h" #import "OFString.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" @implementation OFMutableURI @dynamic scheme, host, percentEncodedHost, port, user, percentEncodedUser; @dynamic password, percentEncodedPassword, path, percentEncodedPath; @dynamic pathComponents, query, percentEncodedQuery, queryItems, fragment; @dynamic percentEncodedFragment; |
︙ | |||
172 173 174 175 176 177 178 | 188 189 190 191 192 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 | - - - + + - - - - - - - + + + + + + | objc_autoreleasePoolPop(pool); } - (void)setPercentEncodedPath: (OFString *)percentEncodedPath { OFString *old; |
︙ | |||
361 362 363 364 365 366 367 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | - + - + - - - - - - - - + | _percentEncodedPath = [path retain]; objc_autoreleasePoolPop(pool); } - (void)standardizePath { |
︙ | |||
407 408 409 410 411 412 413 | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | + - + - + - + | done = false; break; } } } if (startsWithEmpty) |
Added src/OFURI+Private.h version [c5dc8bc44b].
|
Modified src/OFURI.h from [9ffb55b5cf] to [b3a4d03434].
︙ | |||
28 29 30 31 32 33 34 | 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 | - + - + - + | /** * @class OFURI OFURI.h ObjFW/OFURI.h * * @brief A class for parsing URIs as per RFC 3986 and accessing parts of it. */ @interface OFURI: OFObject <OFCopying, OFMutableCopying, OFSerialization> { |
︙ | |||
85 86 87 88 89 90 91 | 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 | - + - - + - + - - + | */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *percentEncodedPassword; /** * @brief The path part of the URI. */ |
︙ | |||
261 262 263 264 265 266 267 268 269 270 271 272 273 274 | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | + + | * @param isDirectory Whether the path is a directory, in which case a slash is * appened if there is no slash yet * @return An initialized OFURI */ - (instancetype)initFileURIWithPath: (OFString *)path isDirectory: (bool)isDirectory; #endif - (instancetype)init OF_UNAVAILABLE; /** * @brief Returns a new URI with the specified path component appended. * * If the URI is a file URI, the file system is queried whether the appended * component is a directory. * |
︙ |
Modified src/OFURI.m from [57bba32cb0] to [fd812a6a57].
︙ | |||
833 834 835 836 837 838 839 840 841 842 843 844 845 846 | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | + + + + + + + + + + | [self release]; @throw e; } return self; } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init { return [super init]; } - (instancetype)initWithSerialization: (OFXMLElement *)element { void *pool = objc_autoreleasePoolPush(); OFString *stringValue; @try { |
︙ | |||
883 884 885 886 887 888 889 | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | - + - - + | return true; if (![object isKindOfClass: [OFURI class]]) return false; URI = object; |
︙ | |||
1046 1047 1048 1049 1050 1051 1052 | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | - - - - - | { void *pool = objc_autoreleasePoolPush(); OFString *path = _percentEncodedPath; const char *UTF8String, *lastComponent; size_t length; OFString *ret; |
︙ | |||
1144 1145 1146 1147 1148 1149 1150 | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | - + - | - (id)copy { return [self retain]; } - (id)mutableCopy { |
︙ | |||
1185 1186 1187 1188 1189 1190 1191 | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | - - + | [ret appendFormat: @"%@@", _percentEncodedUser]; if (_percentEncodedHost != nil) [ret appendString: _percentEncodedHost]; if (_port != nil) [ret appendFormat: @":%@", _port]; |
︙ |
Modified tests/OFURITests.m from [ba89cb38e8] to [e9cb46977b].
︙ | |||
208 209 210 211 212 213 214 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | - + | [[OFURI URIWithString: @"HTTP://bar/"] isEqual: URI3]) TEST(@"-[hash:]", URI1.hash == URI4.hash && URI2.hash != URI3.hash) EXPECT_EXCEPTION(@"Detection of invalid format", OFInvalidFormatException, [OFURI URIWithString: @"http"]) |
︙ |