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
Handle bad import request params freezing writes.
kishorenccaf7b1ec4a70
diff --git a/src/core_api.cpp b/src/core_api.cppindex 42f303d0..30fb7703 100644--- a/src/core_api.cpp+++ b/src/core_api.cpp@@ -451,7 +451,6 @@ bool post_import_documents(http_req& req, http_res& res) {}if(!StringUtils::is_uint32_t(req.params[BATCH_SIZE])) {- req.last_chunk_aggregate = true;res.final = true;res.set_400("Parameter `" + std::string(BATCH_SIZE) + "` must be a positive integer.");HttpServer::stream_response(req, res);@@ -459,7 +458,6 @@ bool post_import_documents(http_req& req, http_res& res) {}if(req.params[ACTION] != "create" && req.params[ACTION] != "update" && req.params[ACTION] != "upsert") {- req.last_chunk_aggregate = true;res.final = true;res.set_400("Parameter `" + std::string(ACTION) + "` must be a create|update|upsert.");HttpServer::stream_response(req, res);@@ -469,7 +467,6 @@ bool post_import_documents(http_req& req, http_res& res) {const size_t IMPORT_BATCH_SIZE = std::stoi(req.params[BATCH_SIZE]);if(IMPORT_BATCH_SIZE == 0) {- req.last_chunk_aggregate = true;res.final = true;res.set_400("Parameter `" + std::string(BATCH_SIZE) + "` must be a positive integer.");HttpServer::stream_response(req, res);@@ -487,7 +484,6 @@ bool post_import_documents(http_req& req, http_res& res) {Collection* collection = collectionManager.get_collection(req.params["collection"]);if(collection == nullptr) {- req.last_chunk_aggregate = true;res.final = true;res.set_404();HttpServer::stream_response(req, res);diff --git a/src/http_server.cpp b/src/http_server.cppindex bd7a3c61..200675e6 100644--- a/src/http_server.cpp+++ b/src/http_server.cpp@@ -703,6 +703,12 @@ void HttpServer::stream_response(http_req& request, http_res& response) {const h2o_send_state_t state = custom_generator->response->final ? H2O_SEND_STATE_FINAL : H2O_SEND_STATE_IN_PROGRESS;h2o_send(req, &body, 1, state);++ if(custom_generator->rpath->async_req && custom_generator->response->final &&+ !custom_generator->request->last_chunk_aggregate) {+ // premature termination of async request: handle this explicitly as otherwise, request is not being closed+ h2o_dispose_request(req);+ }}void HttpServer::destroy_request_response(http_req* request, http_res* response) {