Differences From Artifact [f31f144d07]:
- File src/OFURI.m — part of check-in [e7ab06503c] at 2022-09-28 21:40:00 on branch trunk — Rename OFUR{L -> I} in preparation for URI support (user: js, size: 27443) [annotate] [blame] [check-ins using]
To Artifact [bd23469364]:
- File
src/OFURI.m
— part of check-in
[bd6dd6dd00]
at
2022-09-29 21:53:01
on branch trunk
— OFURI: Make query items an array of pairs
With a dictionary the order is lost and keys cannot exist more than
once. (user: js, size: 27532) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #import "OFDictionary.h" #ifdef OF_HAVE_FILES # import "OFFileManager.h" # import "OFFileURIHandler.h" #endif #import "OFNumber.h" #import "OFOnce.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #import "OFDictionary.h" #ifdef OF_HAVE_FILES # import "OFFileManager.h" # import "OFFileURIHandler.h" #endif #import "OFNumber.h" #import "OFOnce.h" #import "OFPair.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | } - (OFString *)percentEncodedQuery { return _percentEncodedQuery; } | | | > | > | | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | } - (OFString *)percentEncodedQuery { return _percentEncodedQuery; } - (OFArray OF_GENERIC(OFPair OF_GENERIC(OFString *, OFString *) *) *)queryItems { void *pool; OFArray OF_GENERIC(OFString *) *pairs; OFMutableArray OF_GENERIC(OFPair OF_GENERIC(OFString *, OFString *) *) *ret; if (_percentEncodedQuery == nil) return nil; pool = objc_autoreleasePoolPush(); pairs = [_percentEncodedQuery componentsSeparatedByString: @"&"]; ret = [OFMutableArray arrayWithCapacity: pairs.count]; for (OFString *pair in pairs) { OFArray *parts = [pair componentsSeparatedByString: @"="]; OFString *name, *value; if (parts.count != 2) @throw [OFInvalidFormatException exception]; name = [[parts objectAtIndex: 0] stringByRemovingPercentEncoding]; value = [[parts objectAtIndex: 1] stringByRemovingPercentEncoding]; [ret addObject: [OFPair pairWithFirstObject: name secondObject: value]]; } [ret makeImmutable]; [ret retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |