| 173 | } |
| 174 | |
| 175 | static bool parseAuthRealm(SC::StringSpan value, size_t start, size_t end, SC::StringSpan& realm) |
| 176 | { |
| 177 | const SC::Span<const char> bytes = value.toCharSpan(); |
| 178 | size_t idx = start; |
| 179 | while (idx < end) |
| 180 | { |
| 181 | idx = skipAuthSpaces(bytes, idx, end); |
| 182 | if (idx < end and bytes[idx] == ',') |
| 183 | { |
| 184 | idx += 1; |
| 185 | continue; |
| 186 | } |
| 187 | |
| 188 | const size_t nameStart = idx; |
| 189 | const size_t nameEnd = readAuthToken(bytes, nameStart, end); |
| 190 | if (nameStart == nameEnd) |
| 191 | { |
| 192 | idx += 1; |
| 193 | continue; |
| 194 | } |
| 195 | |
| 196 | idx = skipAuthSpaces(bytes, nameEnd, end); |
| 197 | if (idx >= end or bytes[idx] != '=') |
| 198 | { |
| 199 | idx = nameEnd + 1; |
| 200 | continue; |
| 201 | } |
| 202 | |
| 203 | idx = skipAuthSpaces(bytes, idx + 1, end); |
| 204 | if (idx >= end) |
| 205 | { |
| 206 | break; |
| 207 | } |
| 208 | |
| 209 | const bool isRealm = |
| 210 | sessionAsciiEqualsIgnoreCase(sliceString(value, nameStart, nameEnd), SC::StringSpan("realm")); |
| 211 | if (bytes[idx] == '"') |
| 212 | { |
| 213 | const size_t valueStart = idx + 1; |
| 214 | bool escaped = false; |
| 215 | idx += 1; |
| 216 | while (idx < end) |
| 217 | { |
| 218 | if (escaped) |
| 219 | { |
| 220 | escaped = false; |
| 221 | } |
| 222 | else if (bytes[idx] == '\\') |
| 223 | { |
| 224 | escaped = true; |
| 225 | } |
| 226 | else if (bytes[idx] == '"') |
| 227 | { |
| 228 | break; |
| 229 | } |
| 230 | idx += 1; |
| 231 | } |
| 232 |
no test coverage detected