Compression

Garvan can gzip or deflate response bodies on the fly. Enable it at build time and pick a default per app.

Enabling compression

Compile with -DCROW_ENABLE_COMPRESSION and link against zlib:

find_package(ZLIB REQUIRED)
target_compile_definitions(app_bin PRIVATE CROW_ENABLE_COMPRESSION)
target_link_libraries(app_bin PRIVATE ZLIB::ZLIB)

Then turn it on per app:

app.use_compression(crow::compression::GZIP);

Clients that send Accept-Encoding: gzip will receive a compressed body; everyone else gets the response untouched.