From: Alex Rousskov Date: Tue, 7 Dec 2010 19:10:11 +0000 (-0700) Subject: Support upcoming "fresh message creation" eCAP API. X-Git-Tag: take1~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc7b2f6c57c10196ed10b27fb93758e13c019285;p=thirdparty%2Fsquid.git Support upcoming "fresh message creation" eCAP API. Adapters need "fresh" (i.e., empty and not cloned) messages to support "request satisfaction" mode and other cases where cloning a virgin message is not possible or is awkward because the adapted message is not an adjusted version of the virgin one. --- diff --git a/src/adaptation/ecap/Host.cc b/src/adaptation/ecap/Host.cc index 9efe3ba05c..830ab457a1 100644 --- a/src/adaptation/ecap/Host.cc +++ b/src/adaptation/ecap/Host.cc @@ -8,6 +8,9 @@ #include "base/TextException.h" #include "adaptation/ecap/ServiceRep.h" #include "adaptation/ecap/Host.h" +#include "adaptation/ecap/MessageRep.h" +#include "HttpRequest.h" +#include "HttpReply.h" const libecap::Name Adaptation::Ecap::protocolInternal("internal", libecap::Name::NextId()); const libecap::Name Adaptation::Ecap::protocolCacheObj("cache_object", libecap::Name::NextId()); @@ -94,6 +97,19 @@ Adaptation::Ecap::Host::closeDebug(std::ostream *debug) Debug::finishDebug(); } + +Adaptation::Ecap::Host::MessagePtr +Adaptation::Ecap::Host::newRequest() const +{ + return MessagePtr(new Adaptation::Ecap::MessageRep(new HttpRequest)); +} + +Adaptation::Ecap::Host::MessagePtr +Adaptation::Ecap::Host::newResponse() const +{ + return MessagePtr(new Adaptation::Ecap::MessageRep(new HttpReply)); +} + void Adaptation::Ecap::Host::Register() { diff --git a/src/adaptation/ecap/Host.h b/src/adaptation/ecap/Host.h index 8d5f32fa02..6ec696b907 100644 --- a/src/adaptation/ecap/Host.h +++ b/src/adaptation/ecap/Host.h @@ -28,6 +28,11 @@ public: virtual std::ostream *openDebug(libecap::LogVerbosity lv); virtual void closeDebug(std::ostream *debug); + // Message creation + typedef libecap::shared_ptr MessagePtr; + virtual MessagePtr newRequest() const; + virtual MessagePtr newResponse() const; + static void Register(); ///< register adaptation host private: