Skip to content

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

Always populate ip address.

Kishore Nallana290fd620515
diff --git a/src/collection.cpp b/src/collection.cpp
index 34d24f6f..bcd5c119 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -4466,7 +4466,7 @@ Option<uint32_t> Collection::doc_id_to_seq_id(const std::string & doc_id) const
std::string seq_id_str;
StoreStatus status = store->get(get_doc_id_key(doc_id), seq_id_str);
if(status == StoreStatus::FOUND) {
- uint32_t seq_id = (uint32_t) std::stoi(seq_id_str);
+ uint32_t seq_id = std::stoul(seq_id_str);
return Option<uint32_t>(seq_id);
}
diff --git a/src/collection_manager.cpp b/src/collection_manager.cpp
index 063230d4..a6cf8274 100644
--- a/src/collection_manager.cpp
+++ b/src/collection_manager.cpp
@@ -922,7 +922,7 @@ Option<bool> add_unsigned_int_param(const std::string& param_name, const std::st
return Option<bool>(400, "Parameter `" + std::string(param_name) + "` must be an unsigned integer.");
}
- *int_val = std::stoi(str_val);
+ *int_val = std::stoul(str_val);
return Option<bool>(true);
}
@@ -934,7 +934,7 @@ Option<bool> add_unsigned_int_list_param(const std::string& param_name, const st
for(auto& str : str_vals) {
if(StringUtils::is_uint32_t(str)) {
- int_vals->push_back((uint32_t)std::stoi(str));
+ int_vals->push_back((uint32_t)std::stoul(str));
} else {
return Option<bool>(400, "Parameter `" + param_name + "` is malformed.");
}
diff --git a/src/http_server.cpp b/src/http_server.cpp
index 18ad4296..794970ea 100644
--- a/src/http_server.cpp
+++ b/src/http_server.cpp
@@ -310,12 +310,7 @@ int HttpServer::catch_all_handler(h2o_handler_t *_h2o_handler, h2o_req_t *req) {
std::string metric_identifier = http_method + " " + path_without_query;
AppMetrics::get_instance().increment_count(metric_identifier, 1);
- std::string client_ip = "0.0.0.0";
-
- if(Config::get_instance().get_enable_access_logging() ||
- Config::get_instance().get_log_slow_requests_time_ms() >= 0) {
- client_ip = http_req::get_ip_addr(req).ip;
- }
+ std::string client_ip = http_req::get_ip_addr(req).ip;
if(Config::get_instance().get_enable_access_logging()) {
uint64_t now = std::chrono::duration_cast<std::chrono::microseconds>(