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
Fix empty first line in response for large doc import.
Kishore Nallanbf8e78795c41
diff --git a/src/core_api.cpp b/src/core_api.cppindex 36aabae4..7fb851f3 100644--- a/src/core_api.cpp+++ b/src/core_api.cpp@@ -1267,10 +1267,14 @@ bool post_import_documents(const std::shared_ptr<http_req>& req, const std::sharresponse_stream << "\n" << json_lines[i];}}++ // Since we use `res->status_code == 0` for flagging `res_start`, we will only set this+ // when we have accumulated enough response data to stream.+ // Otherwise, we will send an empty line as first response.+ res->status_code = 200;}res->content_type_header = "text/plain; charset=utf-8";- res->status_code = 200;res->body = response_stream.str();res->final.store(req->last_chunk_aggregate);diff --git a/src/http_server.cpp b/src/http_server.cppindex 95ac52c5..6981b7df 100644--- a/src/http_server.cpp+++ b/src/http_server.cpp@@ -833,7 +833,7 @@ void HttpServer::stream_response(stream_response_state_t& state) {if(start_of_res) {h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_CONTENT_TYPE, NULL,state.res_content_type.data(), state.res_content_type.size());- req->res.status = state.status;+ req->res.status = (state.status == 0 && state.send_state != H2O_SEND_STATE_FINAL) ? 200 : state.status;req->res.reason = state.reason;}