@@ -457,7 +457,6 @@ class DataSink {
457457
458458 std::function<bool (const char *data, size_t data_len)> write;
459459 std::function<bool ()> is_writable;
460- std::function<bool ()> is_alive;
461460 std::function<void ()> done;
462461 std::function<void (const Headers &trailer)> done_with_trailer;
463462 std::ostream os;
@@ -591,6 +590,7 @@ struct Response {
591590 Headers headers;
592591 std::string body;
593592 std::string location; // Redirect location
593+ std::function<bool ()> is_alive;
594594
595595 bool has_header (const std::string &key) const ;
596596 std::string get_header_value (const std::string &key, size_t id = 0 ) const ;
@@ -4093,7 +4093,6 @@ inline bool write_content(Stream &strm, const ContentProvider &content_provider,
40934093 };
40944094
40954095 data_sink.is_writable = [&]() -> bool { return strm.is_writable (); };
4096- data_sink.is_alive = [&]() -> bool { return strm.is_alive (); };
40974096
40984097 while (offset < end_offset && !is_shutting_down ()) {
40994098 if (!strm.is_writable ()) {
@@ -4140,7 +4139,6 @@ write_content_without_length(Stream &strm,
41404139 };
41414140
41424141 data_sink.is_writable = [&]() -> bool { return strm.is_writable (); };
4143- data_sink.is_alive = [&]() -> bool { return strm.is_alive (); };
41444142
41454143 data_sink.done = [&](void ) { data_available = false ; };
41464144
@@ -4193,7 +4191,6 @@ write_content_chunked(Stream &strm, const ContentProvider &content_provider,
41934191 };
41944192
41954193 data_sink.is_writable = [&]() -> bool { return strm.is_writable (); };
4196- data_sink.is_alive = [&]() -> bool { return strm.is_alive (); };
41974194
41984195 auto done_with_trailer = [&](const Headers *trailer) {
41994196 if (!ok) { return ; }
@@ -4287,6 +4284,7 @@ inline bool redirect(T &cli, Request &req, Response &res,
42874284 }
42884285
42894286 Response new_res;
4287+ new_res.is_alive = res.is_alive ;
42904288
42914289 auto ret = cli.send (new_req, new_res, error);
42924290 if (ret) {
@@ -6648,6 +6646,7 @@ Server::process_request(Stream &strm, bool close_connection,
66486646 Request req;
66496647
66506648 Response res;
6649+ res.is_alive = [&strm]() { return strm.is_alive (); };
66516650 res.version = " HTTP/1.1" ;
66526651 res.headers = default_headers_;
66536652
0 commit comments