mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-14 16:58:30 +00:00
parent
8311e1105f
commit
986a20fb7d
2 changed files with 22 additions and 1 deletions
|
@ -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;
|
||||
|
@ -2572,7 +2573,7 @@ inline bool is_field_content(const std::string &s) {
|
|||
|
||||
inline bool is_field_value(const std::string &s) { return is_field_content(s); }
|
||||
|
||||
}; // namespace fields
|
||||
} // namespace fields
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue