]> granicus.if.org Git - icinga2/commitdiff
Adjust /v1/events, too
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Fri, 15 Feb 2019 10:51:12 +0000 (11:51 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 1 Apr 2019 09:40:14 +0000 (11:40 +0200)
33 files changed:
lib/remote/actionshandler.cpp
lib/remote/actionshandler.hpp
lib/remote/configfileshandler.cpp
lib/remote/configfileshandler.hpp
lib/remote/configpackageshandler.cpp
lib/remote/configpackageshandler.hpp
lib/remote/configstageshandler.cpp
lib/remote/configstageshandler.hpp
lib/remote/consolehandler.cpp
lib/remote/consolehandler.hpp
lib/remote/createobjecthandler.cpp
lib/remote/createobjecthandler.hpp
lib/remote/deleteobjecthandler.cpp
lib/remote/deleteobjecthandler.hpp
lib/remote/eventshandler.cpp
lib/remote/eventshandler.hpp
lib/remote/httphandler.cpp
lib/remote/httphandler.hpp
lib/remote/httpserverconnection.cpp
lib/remote/infohandler.cpp
lib/remote/infohandler.hpp
lib/remote/modifyobjecthandler.cpp
lib/remote/modifyobjecthandler.hpp
lib/remote/objectqueryhandler.cpp
lib/remote/objectqueryhandler.hpp
lib/remote/statushandler.cpp
lib/remote/statushandler.hpp
lib/remote/templatequeryhandler.cpp
lib/remote/templatequeryhandler.hpp
lib/remote/typequeryhandler.cpp
lib/remote/typequeryhandler.hpp
lib/remote/variablequeryhandler.cpp
lib/remote/variablequeryhandler.hpp

index 5d042fe73a13c07a3fcdd3d10ce8a15fd9297ce4..251f8a82e7f0539b92c782e9084e53c471240588 100644 (file)
@@ -13,11 +13,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/actions", ActionsHandler);
 
 bool ActionsHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 790796ac384945e0715c6b0eeae22bd1c99790f4..9c0463035813b6eea09a5ab2071c3cf5b5e8fcc4 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ActionsHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index 93b63ecd53ef3b64dc09deefe1b947837cba40a2..05def86553fb3c22040c26cb50e508c0ac84e794 100644 (file)
@@ -13,11 +13,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/config/files", ConfigFilesHandler);
 
 bool ConfigFilesHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 50b294493cb6a99db08a5da7d9dd5c3408d07922..1384c2b583bc486e95a54eb712417be4e53af63c 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ConfigFilesHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index 606d232ddc942de32dd7a9fd34db1b7cc18d06f4..2505de36aeee9d9b6c6cb87d6ecf78e1c58fc892 100644 (file)
@@ -11,11 +11,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/config/packages", ConfigPackagesHandler);
 
 bool ConfigPackagesHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 395b778eb0ef383471f65e8a8be95f94b58478c0..2ae184c6ab4d627011006b7ffabefaf5e4e1fa64 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ConfigPackagesHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 
 private:
index 2254511e10c5fa37ad3774b844d149b3244ac290..067181f2757c65a78940bc7ee0bf67480dede6c3 100644 (file)
@@ -12,11 +12,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/config/stages", ConfigStagesHandler);
 
 bool ConfigStagesHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index aec7d4eeeffe54d694c2e28251909d6194e35b8f..4ee35ad91cd5ad55253e1ff12171e4ca3cf805cc 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ConfigStagesHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 
 private:
index f513b21c0b28d7966ad2826b26896a2bb6514818..430a37cf3c4ff68f68941772ed3d217fb84887b0 100644 (file)
@@ -54,11 +54,14 @@ static void EnsureFrameCleanupTimer()
 }
 
 bool ConsoleHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 0c0a12399aaf23d0facdc34ce03aaffaf7325f25..339f3ed86a238c59ea7cb9d3009d360275227e73 100644 (file)
@@ -23,11 +23,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ConsoleHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 
        static std::vector<String> GetAutocompletionSuggestions(const String& word, ScriptFrame& frame);
index bf9cb990e9ca8dbe2bc2e993f615bae425659572..1f7ab6710b8e203f414074223ef4125bf6ff8f23 100644 (file)
@@ -15,11 +15,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/objects", CreateObjectHandler);
 
 bool CreateObjectHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 646b07fc6c8bddca0633a27110cc3d8a55bdb462..ff42a62e6ac249c46b7fca51306bae04e7bf2550 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(CreateObjectHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index 996effea84eaabdc12cb7dc927d594eeedac3275..15951588e018755374a7f0cc9d83d12f94102d65 100644 (file)
@@ -15,11 +15,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/objects", DeleteObjectHandler);
 
 bool DeleteObjectHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 97fbbc5be6340a1d84dd9b0b1a9058256998867d..3ecb0c71b5643393bed82614930c611b5cb42024 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(DeleteObjectHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index ed829706d2f1ca8f68b1bbf85ee69fc4771cf9f8..99843d481d5460217fb716a49d1f3565dec611d7 100644 (file)
@@ -5,8 +5,10 @@
 #include "remote/filterutility.hpp"
 #include "config/configcompiler.hpp"
 #include "config/expression.hpp"
+#include "base/defer.hpp"
 #include "base/objectlock.hpp"
 #include "base/json.hpp"
+#include <boost/asio/buffer.hpp>
 #include <boost/algorithm/string/replace.hpp>
 
 using namespace icinga;
@@ -14,13 +16,17 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/events", EventsHandler);
 
 bool EventsHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
+       namespace asio = boost::asio;
        namespace http = boost::beast::http;
 
        if (url->GetPath().size() != 2)
@@ -75,18 +81,24 @@ bool EventsHandler::HandleRequest(
 
        queue->AddClient(&request);
 
+       Defer removeClient ([&queue, &request, &queueName]() {
+               queue->RemoveClient(&request);
+               EventQueue::UnregisterIfUnused(queueName, queue);
+       });
+
+       hasStartedStreaming = true;
+
        response.result(http::status::ok);
        response.set(http::field::content_type, "application/json");
 
+       http::async_write(stream, response, yc);
+       stream.async_flush(yc);
+
+       asio::const_buffer newLine ("\n", 1);
+
        for (;;) {
                Dictionary::Ptr result = queue->WaitForEvent(&request);
 
-               if (!response.IsPeerConnected()) {
-                       queue->RemoveClient(&request);
-                       EventQueue::UnregisterIfUnused(queueName, queue);
-                       return true;
-               }
-
                if (!result)
                        continue;
 
@@ -94,14 +106,11 @@ bool EventsHandler::HandleRequest(
 
                boost::algorithm::replace_all(body, "\n", "");
 
-               try {
-                       response.WriteBody(body.CStr(), body.GetLength());
-                       response.WriteBody("\n", 1);
-               } catch (const std::exception&) {
-                       queue->RemoveClient(&request);
-                       EventQueue::UnregisterIfUnused(queueName, queue);
-                       throw;
-               }
+               asio::const_buffer payload (body.CStr(), body.GetLength());
+
+               stream.async_write_some(payload, yc);
+               stream.async_write_some(newLine, yc);
+               stream.async_flush(yc);
        }
 }
 
index d95d31bf10fd8050746bcd7ed29dc2ef516dc76a..cffeea5034f664e350830c76e6f26ea91083ebac 100644 (file)
@@ -15,11 +15,14 @@ public:
        DECLARE_PTR_TYPEDEFS(EventsHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index d6ea3426ba55295cae0409f40246933639a6ac49..c089c00ea51a157c6c69f83996d7f39899543ce8 100644 (file)
@@ -46,9 +46,12 @@ void HttpHandler::Register(const Url::Ptr& url, const HttpHandler::Ptr& handler)
 }
 
 void HttpHandler::ProcessRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
-       boost::beast::http::response<boost::beast::http::string_body>& response
+       boost::beast::http::response<boost::beast::http::string_body>& response,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        Dictionary::Ptr node = m_UrlTree;
@@ -96,7 +99,7 @@ void HttpHandler::ProcessRequest(
 
        bool processed = false;
        for (const HttpHandler::Ptr& handler : handlers) {
-               if (handler->HandleRequest(user, request, url, response, params)) {
+               if (handler->HandleRequest(stream, user, request, url, response, params, yc, hasStartedStreaming)) {
                        processed = true;
                        break;
                }
index 7e74329e0ccf1d9b45b7610d597d44cffa89eac4..cec5f58cd1611721a4642764bbcae6a9f6705249 100644 (file)
@@ -8,7 +8,9 @@
 #include "remote/httpresponse.hpp"
 #include "remote/apiuser.hpp"
 #include "base/registry.hpp"
+#include "base/tlsstream.hpp"
 #include <vector>
+#include <boost/asio/spawn.hpp>
 #include <boost/beast/http.hpp>
 
 namespace icinga
@@ -25,18 +27,24 @@ public:
        DECLARE_PTR_TYPEDEFS(HttpHandler);
 
        virtual bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) = 0;
 
        static void Register(const Url::Ptr& url, const HttpHandler::Ptr& handler);
        static void ProcessRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
-               boost::beast::http::response<boost::beast::http::string_body>& response
+               boost::beast::http::response<boost::beast::http::string_body>& response,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        );
 
 private:
index 87db3da5c481001a908bbd61105c137234aa295b..7ea206f5ffae60242bae0c0cf04d5284d8505568 100644 (file)
@@ -311,7 +311,7 @@ bool EnsureValidBody(
 }
 
 static inline
-void ProcessRequest(
+bool ProcessRequest(
        AsioTlsStream& stream,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        ApiUser::Ptr& authenticatedUser,
@@ -321,11 +321,17 @@ void ProcessRequest(
 {
        namespace http = boost::beast::http;
 
+       bool hasStartedStreaming = false;
+
        try {
                CpuBoundWork handlingRequest (yc);
 
-               HttpHandler::ProcessRequest(authenticatedUser, request, response);
+               HttpHandler::ProcessRequest(stream, authenticatedUser, request, response, yc, hasStartedStreaming);
        } catch (const std::exception& ex) {
+               if (hasStartedStreaming) {
+                       return false;
+               }
+
                http::response<http::string_body> response;
 
                HttpUtility::SendJsonError(response, nullptr, 500, "Unhandled exception" , DiagnosticInformation(ex));
@@ -333,11 +339,17 @@ void ProcessRequest(
                http::async_write(stream, response, yc);
                stream.async_flush(yc);
 
-               return;
+               return true;
+       }
+
+       if (hasStartedStreaming) {
+               return false;
        }
 
        http::async_write(stream, response, yc);
        stream.async_flush(yc);
+
+       return true;
 }
 
 void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
@@ -419,7 +431,9 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
                                break;
                        }
 
-                       ProcessRequest(*m_Stream, request, authenticatedUser, response, yc);
+                       if (!ProcessRequest(*m_Stream, request, authenticatedUser, response, yc)) {
+                               break;
+                       }
 
                        if (request.version() != 11 || request[http::field::connection] == "close") {
                                break;
index c605cca8b8cd120f2b2b3d7839ed77c463bcead8..38f99781d01ac9d4c36d6b6c97c86698ecc36a71 100644 (file)
@@ -9,11 +9,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/", InfoHandler);
 
 bool InfoHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 418bb9b4bbfc53a53b4350ad268e3b5fc08a8918..346340d8180bc1052dcc90cadffe198e62ed2cb2 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(InfoHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index af800cce172cc7533f34931efb4fdb921276ce99..2150903a1fa394bf4fcbec873256398246d86cc9 100644 (file)
@@ -13,11 +13,14 @@ using namespace icinga;
 REGISTER_URLHANDLER("/v1/objects", ModifyObjectHandler);
 
 bool ModifyObjectHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index e63304beb355ad8cf6acef54fd7b0d6137bace2c..c9bb216124875a60b0281a474e567ad1c09901ce 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ModifyObjectHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index 63a67d85369aca72b54d3d821cfa493521cd9c4f..2d9b798458456925fea96e1cdf535b21e09ed2e5 100644 (file)
@@ -88,11 +88,14 @@ Dictionary::Ptr ObjectQueryHandler::SerializeObjectAttrs(const Object::Ptr& obje
 }
 
 bool ObjectQueryHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 86d3ef8784258f88296df73aa27ed68cbcf29f59..c35ff4066ce9d2ad84202089b7dcc439abf5d00b 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(ObjectQueryHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 
 private:
index 9b1175ba43738674c035dc8ef51be139ed44abf2..cc725e4f42158112a62e1d3e09b2797f3e9f2f80 100644 (file)
@@ -69,11 +69,14 @@ public:
 };
 
 bool StatusHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index a2616161202a616ce83349d912ce9629d67907eb..36f5efcf15cd2521934132eba2c7ea25d9b1a295 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(StatusHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index 9508163b10a7759d72be7fe4c0166f5b2850d65c..38a2255401131fabb5ad7f9d0af981acce4c8344 100644 (file)
@@ -76,11 +76,14 @@ public:
 };
 
 bool TemplateQueryHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index e98bcd24976b3aa6328ab78220d1aa061bc6e422..e9dec8896d4b68fa4cb5daf78bdc3e215e5aa2b6 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(TemplateQueryHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index 70c83f7e7c3c00a314a317e607cf17307cd3376e..07711377473924989d9031e310f447d2354dcb9a 100644 (file)
@@ -47,11 +47,14 @@ public:
 };
 
 bool TypeQueryHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 69d65baec3bcd5d27c2bbf277a01e7179e0e12f3..84c04185d1e3aa6f398b917e59ffa79d7f064742 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(TypeQueryHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };
 
index dcf01d3e92f69b1cf3575a27ed3fc7a76171b508..05b503783d96e9f11b96d140d271b70a196e78ce 100644 (file)
@@ -57,11 +57,14 @@ public:
 };
 
 bool VariableQueryHandler::HandleRequest(
+       AsioTlsStream& stream,
        const ApiUser::Ptr& user,
        boost::beast::http::request<boost::beast::http::string_body>& request,
        const Url::Ptr& url,
        boost::beast::http::response<boost::beast::http::string_body>& response,
-       const Dictionary::Ptr& params
+       const Dictionary::Ptr& params,
+       boost::asio::yield_context& yc,
+       bool& hasStartedStreaming
 )
 {
        namespace http = boost::beast::http;
index 5da2e13ab34ee249c6d047ee6ccc8020fcbec48a..ecc71a96aa08318f3ea6946bca37491a1e8cf062 100644 (file)
@@ -14,11 +14,14 @@ public:
        DECLARE_PTR_TYPEDEFS(VariableQueryHandler);
 
        bool HandleRequest(
+               AsioTlsStream& stream,
                const ApiUser::Ptr& user,
                boost::beast::http::request<boost::beast::http::string_body>& request,
                const Url::Ptr& url,
                boost::beast::http::response<boost::beast::http::string_body>& response,
-               const Dictionary::Ptr& params
+               const Dictionary::Ptr& params,
+               boost::asio::yield_context& yc,
+               bool& hasStartedStreaming
        ) override;
 };