MCPcopy Create free account
hub / github.com/comaps/comaps / Decompress

Function Decompress

libs/platform/http_client_curl.cpp:153–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153std::string Decompress(std::string const & compressed, std::string const & encoding)
154{
155 std::string decompressed;
156
157 if (encoding == "deflate")
158 {
159 ZLib::Inflate inflate(ZLib::Inflate::Format::ZLib);
160
161 // We do not check return value of inflate here.
162 // It may return false if compressed data is broken or if there is some unconsumed data
163 // at the end of buffer. The second case considered as ok by some http clients.
164 // For example, server we use for AsyncGuiThread_GetHotelInfo test adds '\n' to the end of the buffer
165 // and MacOS client and some versions of curl return no error.
166 UNUSED_VALUE(inflate(compressed, back_inserter(decompressed)));
167 }
168 else
169 {
170 ASSERT(false, ("Unsupported Content-Encoding:", encoding));
171 }
172
173 return decompressed;
174}
175} // namespace
176// Used as a test stub for basic HTTP client implementation.
177// Make sure that you have curl installed in the PATH.

Callers 1

RunHttpRequestMethod · 0.85

Calls 1

ASSERTFunction · 0.85

Tested by

no test coverage detected