| 1056 | } |
| 1057 | |
| 1058 | bool SC::HttpClientResponse::getNextContentCoding(HttpClientContentCodingIterator& iterator, |
| 1059 | HttpClientContentCoding& contentCoding) const |
| 1060 | { |
| 1061 | contentCoding = {}; |
| 1062 | |
| 1063 | for (;;) |
| 1064 | { |
| 1065 | if (not iterator.hasHeaderValue or iterator.valueOffset >= iterator.headerValue.sizeInBytes()) |
| 1066 | { |
| 1067 | if (not findNextHeader("Content-Encoding", iterator.headerIterator, iterator.headerValue)) |
| 1068 | { |
| 1069 | iterator.hasHeaderValue = false; |
| 1070 | return false; |
| 1071 | } |
| 1072 | iterator.valueOffset = 0; |
| 1073 | iterator.hasHeaderValue = true; |
| 1074 | } |
| 1075 | |
| 1076 | const Span<const char> bytes = iterator.headerValue.toCharSpan(); |
| 1077 | while (iterator.valueOffset < bytes.sizeInBytes() and |
| 1078 | (bytes[iterator.valueOffset] == ',' or bytes[iterator.valueOffset] == ' ' or |
| 1079 | bytes[iterator.valueOffset] == '\t')) |
| 1080 | { |
| 1081 | iterator.valueOffset += 1; |
| 1082 | } |
| 1083 | |
| 1084 | const size_t tokenStart = iterator.valueOffset; |
| 1085 | while (iterator.valueOffset < bytes.sizeInBytes() and bytes[iterator.valueOffset] != ',') |
| 1086 | { |
| 1087 | iterator.valueOffset += 1; |
| 1088 | } |
| 1089 | |
| 1090 | const StringSpan token = trimAsciiWhiteSpace({bytes.data() + tokenStart, iterator.valueOffset - tokenStart}); |
| 1091 | if (iterator.valueOffset < bytes.sizeInBytes() and bytes[iterator.valueOffset] == ',') |
| 1092 | { |
| 1093 | iterator.valueOffset += 1; |
| 1094 | } |
| 1095 | |
| 1096 | if (token.sizeInBytes() == 0) |
| 1097 | { |
| 1098 | continue; |
| 1099 | } |
| 1100 | |
| 1101 | contentCoding.name = token; |
| 1102 | contentCoding.type = HttpClientContentCoding::parseName(token); |
| 1103 | return true; |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | bool SC::HttpClientResponse::getNextTransferCoding(HttpClientTransferCodingIterator& iterator, |
| 1108 | HttpClientTransferCoding& transferCoding) const |