From 7adb85ac3eafe6a0a63506e6d78d487581c69ded Mon Sep 17 00:00:00 2001 From: Sunitha Harish Date: Tue, 26 Oct 2021 03:10:04 -0500 Subject: EventService: Pass httpHeaders to subscriber Custom http headers provided by the subscriber was not passed on to the http client request header This commit passes the http headers to the Subscriber constructor Tested by: Subscribe to events with custom headers Verify the event request packet sending the custom header to the subscriber Verified persistency of the subscription Signed-off-by: Sunitha Harish Change-Id: I9a4f59b6e9477fae96b380565885f4ac51e2a628 --- redfish-core/include/event_service_manager.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'redfish-core/include/event_service_manager.hpp') diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index b501265a17..010c991176 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -383,9 +383,7 @@ class Subscription : public persistent_data::UserSubscription eventSeqNum(1), host(inHost), port(inPort), path(inPath), uriProto(inUriProto) { - conn = std::make_shared( - crow::connections::systemBus->get_io_context(), id, host, port, - path, httpHeaders); + // Subscription constructor } Subscription(const std::shared_ptr& adaptor) : @@ -398,12 +396,17 @@ class Subscription : public persistent_data::UserSubscription void sendEvent(const std::string& msg) { - if (conn != nullptr) + if (conn == nullptr) { - conn->sendData(msg); - this->eventSeqNum++; + // create the HttpClient connection + conn = std::make_shared( + crow::connections::systemBus->get_io_context(), id, host, port, + path, httpHeaders); } + conn->sendData(msg); + eventSeqNum++; + if (sseConn != nullptr) { sseConn->sendData(eventSeqNum, msg); -- cgit v1.2.3