Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Enable gzip compression for responses.
Kishore Nallan2714f6ee0c83
diff --git a/TODO.md b/TODO.mdindex a1f55fd2..e07ea499 100644--- a/TODO.md+++ b/TODO.md@@ -93,8 +93,8 @@- ~~Deprecate converting integer to string verbatim~~- ~~Deprecate union type punning~~- ~~Replica server should fail when pointed to "old" master~~+- ~~gzip compress responses~~- Parameterize replica's MAX_UPDATES_TO_SEND-- gzip compress responses- NOT operator support- > INT32_MAX validation for float field- highlight of string arrays?diff --git a/include/http_server.h b/include/http_server.hindex b7b66ec1..595e285f 100644--- a/include/http_server.h+++ b/include/http_server.h@@ -22,6 +22,7 @@ struct request_response {class HttpServer {private:h2o_globalconf_t config;+ h2o_compress_args_t compress_args;h2o_context_t ctx;h2o_accept_ctx_t* accept_ctx;h2o_hostconf_t *hostconf;diff --git a/src/http_server.cpp b/src/http_server.cppindex 21f3dfe1..b78c5cdb 100644--- a/src/http_server.cpp+++ b/src/http_server.cpp@@ -211,6 +211,12 @@ h2o_pathconf_t* HttpServer::register_handler(h2o_hostconf_t *hostconf, const chah2o_custom_req_handler_t *handler = reinterpret_cast<h2o_custom_req_handler_t*>(h2o_create_handler(pathconf, sizeof(*handler)));handler->http_server = this;handler->super.on_req = on_req;++ compress_args.min_size = 256; // don't gzip less than this size+ compress_args.brotli.quality = -1; // disable, not widely supported+ compress_args.gzip.quality = 1; // fastest+ h2o_compress_register(pathconf, &compress_args);+return pathconf;}