| 144 | } |
| 145 | |
| 146 | Result httpContentEncodingFromHeader(StringSpan headerValue, HttpContentEncoding& encoding) |
| 147 | { |
| 148 | HttpStringIterator it(headerValue); |
| 149 | while (it.match(' ') or it.match('\t')) |
| 150 | { |
| 151 | if (not it.stepForward()) |
| 152 | { |
| 153 | break; |
| 154 | } |
| 155 | } |
| 156 | const auto start = it; |
| 157 | while (not it.isAtEnd() and not it.match(' ') and not it.match('\t') and not it.match(',')) |
| 158 | { |
| 159 | if (not it.stepForward()) |
| 160 | { |
| 161 | break; |
| 162 | } |
| 163 | } |
| 164 | StringSpan token = HttpStringIterator::fromIterators(start, it, headerValue.getEncoding()); |
| 165 | if (token.isEmpty() or HttpStringIterator::equalsIgnoreCase(token, "identity")) |
| 166 | { |
| 167 | encoding = HttpContentEncoding::Identity; |
| 168 | return Result(true); |
| 169 | } |
| 170 | if (HttpStringIterator::equalsIgnoreCase(token, "gzip")) |
| 171 | { |
| 172 | encoding = HttpContentEncoding::GZip; |
| 173 | return Result(true); |
| 174 | } |
| 175 | if (HttpStringIterator::equalsIgnoreCase(token, "deflate")) |
| 176 | { |
| 177 | encoding = HttpContentEncoding::Deflate; |
| 178 | return Result(true); |
| 179 | } |
| 180 | return Result::Error("HttpContentEncoding unsupported content encoding"); |
| 181 | } |
| 182 | |
| 183 | //------------------------------------------------------------------------------------------------------- |
| 184 | // HttpMultipartWriter |
no test coverage detected