Skip to content

Commit

Permalink
Resolve #2017
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Jan 17, 2025
1 parent 8311e11 commit 243e093
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ struct Request {
Ranges ranges;
Match matches;
std::unordered_map<std::string, std::string> path_params;
std::function<bool()> is_connection_closed = []() { return true; };

// for client
ResponseHandler response_handler;
Expand Down Expand Up @@ -7217,6 +7218,11 @@ Server::process_request(Stream &strm, const std::string &remote_addr,
}
}

// Setup `is_connection_closed` method
req.is_connection_closed = [&]() {
return !detail::is_socket_alive(strm.socket());
};

// Routing
auto routed = false;
#ifdef CPPHTTPLIB_NO_EXCEPTIONS
Expand Down

0 comments on commit 243e093

Please sign in to comment.