Differences From Artifact [57bba32cb0]:
- File
src/OFURI.m
— part of check-in
[13ead1212f]
at
2022-10-11 00:18:40
on branch trunk
— OFURI: Remove percentEncodedScheme
The scheme does not allow percent encoding. (user: js, size: 28245) [annotate] [blame] [check-ins using]
To Artifact [fd812a6a57]:
- File
src/OFURI.m
— part of check-in
[3e455c4839]
at
2022-10-11 19:27:09
on branch trunk
— OFURI: Make scheme and path nonnull
This is as per the RFC, which says the scheme and path can never be
missing, while the path can be empty. (user: js, size: 28143) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
833 834 835 836 837 838 839 840 841 842 843 844 845 846 | [self release]; @throw e; } return self; } #endif - (instancetype)initWithSerialization: (OFXMLElement *)element { void *pool = objc_autoreleasePoolPush(); OFString *stringValue; @try { | > > > > > > > > > > | 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 | return true; if (![object isKindOfClass: [OFURI class]]) return false; URI = object; | | < | | 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; if (![URI->_scheme isEqual: _scheme]) return false; if (URI->_percentEncodedHost != _percentEncodedHost && ![URI->_percentEncodedHost isEqual: _percentEncodedHost]) return false; if (URI->_port != _port && ![URI->_port isEqual: _port]) return false; if (URI->_percentEncodedUser != _percentEncodedUser && ![URI->_percentEncodedUser isEqual: _percentEncodedUser]) return false; if (URI->_percentEncodedPassword != _percentEncodedPassword && ![URI->_percentEncodedPassword isEqual: _percentEncodedPassword]) return false; if (![URI->_percentEncodedPath isEqual: _percentEncodedPath]) return false; if (URI->_percentEncodedQuery != _percentEncodedQuery && ![URI->_percentEncodedQuery isEqual: _percentEncodedQuery]) return false; if (URI->_percentEncodedFragment != _percentEncodedFragment && ![URI->_percentEncodedFragment isEqual: _percentEncodedFragment]) return false; |
︙ | ︙ | |||
1046 1047 1048 1049 1050 1051 1052 | { void *pool = objc_autoreleasePoolPush(); OFString *path = _percentEncodedPath; const char *UTF8String, *lastComponent; size_t length; OFString *ret; | < < < < < | 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; if ([path isEqual: @"/"]) { objc_autoreleasePoolPop(pool); return @"/"; } if ([path hasSuffix: @"/"]) path = [path substringToIndex: path.length - 1]; |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | - (id)copy { return [self retain]; } - (id)mutableCopy { | | < | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | - (id)copy { return [self retain]; } - (id)mutableCopy { OFURI *copy = [[OFMutableURI alloc] initWithScheme: _scheme]; @try { copy->_percentEncodedHost = [_percentEncodedHost copy]; copy->_port = [_port copy]; copy->_percentEncodedUser = [_percentEncodedUser copy]; copy->_percentEncodedPassword = [_percentEncodedPassword copy]; copy->_percentEncodedPath = [_percentEncodedPath copy]; copy->_percentEncodedQuery = [_percentEncodedQuery copy]; copy->_percentEncodedFragment = [_percentEncodedFragment copy]; |
︙ | ︙ | |||
1185 1186 1187 1188 1189 1190 1191 | [ret appendFormat: @"%@@", _percentEncodedUser]; if (_percentEncodedHost != nil) [ret appendString: _percentEncodedHost]; if (_port != nil) [ret appendFormat: @":%@", _port]; | < | | 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]; [ret appendString: _percentEncodedPath]; if (_percentEncodedQuery != nil) [ret appendFormat: @"?%@", _percentEncodedQuery]; if (_percentEncodedFragment != nil) [ret appendFormat: @"#%@", _percentEncodedFragment]; |
︙ | ︙ |