| 955 | } |
| 956 | |
| 957 | SC::Result SC::HttpClientContentCoding::writeAcceptEncoding(Span<const Type> types, Span<char> destination, |
| 958 | StringSpan& value) |
| 959 | { |
| 960 | if (types.empty()) |
| 961 | return Result::Error(HttpClientResultCategory, HttpClientError::ContentCodingListEmpty); |
| 962 | |
| 963 | size_t usedBytes = 0; |
| 964 | for (size_t idx = 0; idx < types.sizeInElements(); ++idx) |
| 965 | { |
| 966 | if (types[idx] == Unknown) |
| 967 | return Result::Error(HttpClientResultCategory, HttpClientError::ContentCodingUnknown); |
| 968 | |
| 969 | const char* const name = getName(types[idx]); |
| 970 | const size_t nameBytes = strlen(name); |
| 971 | const size_t sepBytes = idx == 0 ? 0 : 2; |
| 972 | if (destination.sizeInBytes() - usedBytes < sepBytes + nameBytes) |
| 973 | return Result::Error(HttpClientResultCategory, HttpClientError::AcceptEncodingOutputTooSmall); |
| 974 | |
| 975 | if (sepBytes > 0) |