From: Amos Jeffries Date: Thu, 16 Feb 2017 11:51:56 +0000 (+1300) Subject: SourceLayout: move HttpMsg into libhttp as Http::Message X-Git-Tag: M-staged-PR71~267 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63df1d28185266da3587a1825296302c4555c8e4;p=thirdparty%2Fsquid.git SourceLayout: move HttpMsg into libhttp as Http::Message * move files and rename the class * add http/forward.h entries for Message and MessagePointer (replacing the HttpMsg::Pointer typedef) * remove unnecessary includes for HttpMsg.h and HttpRequest.h Also, some minor cleanup within the class files reducing debugs() duplication, function/method coding style and doxtgen'ating some code comments. --- diff --git a/src/HttpReply.cc b/src/HttpReply.cc index e40a1320b0..16057b7e72 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -25,7 +25,7 @@ #include "Store.h" #include "StrList.h" -HttpReply::HttpReply() : HttpMsg(hoReply), date (0), last_modified (0), +HttpReply::HttpReply() : Http::Message(hoReply), date (0), last_modified (0), expires (0), surrogate_control (NULL), content_range (NULL), keep_alive (0), protoPrefix("HTTP/"), bodySizeMax(-2) { @@ -308,7 +308,7 @@ HttpReply::hdrExpirationTime() void HttpReply::hdrCacheInit() { - HttpMsg::hdrCacheInit(); + Http::Message::hdrCacheInit(); http_ver = sline.version; content_length = header.getInt64(Http::HdrType::CONTENT_LENGTH); @@ -443,7 +443,7 @@ HttpReply::parseFirstLine(const char *blk_start, const char *blk_end) int HttpReply::httpMsgParseError() { - int result(HttpMsg::httpMsgParseError()); + int result(Http::Message::httpMsgParseError()); /* indicate an error in the status line */ sline.set(Http::ProtocolVersion(), Http::scInvalidHeader); return result; @@ -553,7 +553,8 @@ HttpReply::clone() const return rep; } -bool HttpReply::inheritProperties(const HttpMsg *aMsg) +bool +HttpReply::inheritProperties(const Http::Message *aMsg) { const HttpReply *aRep = dynamic_cast(aMsg); if (!aRep) diff --git a/src/HttpReply.h b/src/HttpReply.h index 36418cf1a7..c2177e92c7 100644 --- a/src/HttpReply.h +++ b/src/HttpReply.h @@ -11,7 +11,6 @@ #include "http/StatusLine.h" #include "HttpBody.h" -#include "HttpMsg.h" #include "HttpRequest.h" void httpReplyInitModule(void); @@ -22,7 +21,7 @@ class HttpHdrContRange; class HttpHdrSc; -class HttpReply: public HttpMsg +class HttpReply: public Http::Message { MEMPROXY_CLASS(HttpReply); @@ -70,7 +69,7 @@ public: virtual bool expectingBody(const HttpRequestMethod&, int64_t&) const; - virtual bool inheritProperties(const HttpMsg *aMsg); + virtual bool inheritProperties(const Http::Message *); bool updateOnNotModified(HttpReply const *other); diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 3c5d05ed94..bcd0b7fa65 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -39,13 +39,13 @@ #endif HttpRequest::HttpRequest() : - HttpMsg(hoRequest) + Http::Message(hoRequest) { init(); } HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aSchemeImg, const char *aUrlpath) : - HttpMsg(hoRequest) + Http::Message(hoRequest) { static unsigned int id = 1; debugs(93,7, HERE << "constructed, this=" << this << " id=" << ++id); @@ -207,7 +207,7 @@ HttpRequest::clone() const } bool -HttpRequest::inheritProperties(const HttpMsg *aMsg) +HttpRequest::inheritProperties(const Http::Message *aMsg) { const HttpRequest* aReq = dynamic_cast(aMsg); if (!aReq) @@ -386,7 +386,7 @@ HttpRequest::prefixLen() const void HttpRequest::hdrCacheInit() { - HttpMsg::hdrCacheInit(); + Http::Message::hdrCacheInit(); assert(!range); range = header.getRange(); diff --git a/src/HttpRequest.h b/src/HttpRequest.h index e84c738785..5c097042cd 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -13,8 +13,8 @@ #include "dns/forward.h" #include "err_type.h" #include "HierarchyLogEntry.h" +#include "http/Message.h" #include "http/RequestMethod.h" -#include "HttpMsg.h" #include "Notes.h" #include "RequestFlags.h" #include "URL.h" @@ -41,7 +41,7 @@ void httpRequestPack(void *obj, Packable *p); class HttpHdrRange; -class HttpRequest: public HttpMsg +class HttpRequest: public Http::Message { MEMPROXY_CLASS(HttpRequest); @@ -236,7 +236,7 @@ protected: virtual void hdrCacheInit(); - virtual bool inheritProperties(const HttpMsg *aMsg); + virtual bool inheritProperties(const Http::Message *); }; class ConnStateData; diff --git a/src/Makefile.am b/src/Makefile.am index 29269f3308..cc4ae2c2c9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -335,8 +335,6 @@ squid_SOURCES = \ HttpBody.cc \ HttpControlMsg.cc \ HttpControlMsg.h \ - HttpMsg.cc \ - HttpMsg.h \ HttpReply.cc \ HttpReply.h \ RequestFlags.h \ @@ -943,8 +941,6 @@ tests_testHttpReply_SOURCES=\ HttpHeaderTools.cc \ HttpControlMsg.cc \ HttpControlMsg.h \ - HttpMsg.cc \ - HttpMsg.h \ HttpReply.cc \ HttpReply.h \ MasterXaction.cc \ @@ -1044,7 +1040,6 @@ tests_testACLMaxUserIP_SOURCES= \ HttpHdrCc.cc \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ - HttpMsg.cc \ int.h \ int.cc \ MasterXaction.cc \ @@ -1272,7 +1267,6 @@ tests_testCacheManager_SOURCES = \ HttpHdrRange.cc \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ - HttpMsg.cc \ HttpReply.cc \ icp_v2.cc \ icp_v3.cc \ @@ -1461,7 +1455,6 @@ tests_testDiskIO_SOURCES = \ HttpHeaderTools.cc \ HttpHeader.h \ HttpHeader.cc \ - HttpMsg.cc \ HttpReply.cc \ int.h \ int.cc \ @@ -1691,7 +1684,6 @@ tests_testEvent_SOURCES = \ HttpHdrRange.cc \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ - HttpMsg.cc \ HttpReply.cc \ PeerPoolMgr.h \ PeerPoolMgr.cc \ @@ -1927,7 +1919,6 @@ tests_testEventLoop_SOURCES = \ HttpHdrRange.cc \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ - HttpMsg.cc \ HttpReply.cc \ PeerPoolMgr.h \ PeerPoolMgr.cc \ @@ -2158,7 +2149,6 @@ tests_test_http_range_SOURCES = \ HttpHeaderFieldInfo.h \ HttpHeaderTools.h \ HttpHeaderTools.cc \ - HttpMsg.cc \ HttpReply.cc \ PeerPoolMgr.h \ PeerPoolMgr.cc \ @@ -2473,7 +2463,6 @@ tests_testHttpRequest_SOURCES = \ HttpHdrRange.cc \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ - HttpMsg.cc \ HttpReply.cc \ icp_v2.cc \ icp_v3.cc \ @@ -2707,7 +2696,6 @@ tests_testStore_SOURCES= \ HttpHeaderTools.cc \ HttpHeader.h \ HttpHeader.cc \ - HttpMsg.cc \ RequestFlags.cc \ RequestFlags.h \ int.h \ @@ -2959,7 +2947,6 @@ tests_testUfs_SOURCES = \ tests/stub_CacheDigest.cc \ ConfigParser.cc \ EventLoop.cc \ - HttpMsg.cc \ RemovalPolicy.cc \ repl_modules.h \ store.cc \ @@ -3116,7 +3103,6 @@ tests_testRock_SOURCES = \ HttpHeaderFieldInfo.h \ HttpHeaderTools.h \ HttpHeaderTools.cc \ - HttpMsg.cc \ HttpReply.cc \ int.h \ int.cc \ @@ -3315,7 +3301,6 @@ tests_testURL_SOURCES = \ HttpHeaderFieldInfo.h \ HttpHeaderTools.h \ HttpHeaderTools.cc \ - HttpMsg.cc \ HttpReply.cc \ PeerPoolMgr.h \ PeerPoolMgr.cc \ diff --git a/src/MemObject.cc b/src/MemObject.cc index 10a06bc800..aeb265cafc 100644 --- a/src/MemObject.cc +++ b/src/MemObject.cc @@ -285,7 +285,7 @@ MemObject::expectedReplySize() const if (_reply) { const int64_t clen = _reply->bodySize(method); debugs(20, 7, HERE << "clen: " << clen); - if (clen >= 0 && _reply->hdr_sz > 0) // yuck: HttpMsg sets hdr_sz to 0 + if (clen >= 0 && _reply->hdr_sz > 0) // yuck: Http::Message sets hdr_sz to 0 return clen + _reply->hdr_sz; } diff --git a/src/acl/ConnectionsEncrypted.cc b/src/acl/ConnectionsEncrypted.cc index 19b33a571e..890f6d426b 100644 --- a/src/acl/ConnectionsEncrypted.cc +++ b/src/acl/ConnectionsEncrypted.cc @@ -63,9 +63,9 @@ Acl::ConnectionsEncrypted::match(ACLChecklist *checklist) ACLFilledChecklist *filled = Filled((ACLChecklist*)checklist); const bool safeRequest = - !(filled->request->sources & HttpMsg::srcUnsafe); + !(filled->request->sources & Http::Message::srcUnsafe); const bool safeReply = !filled->reply || - !(filled->reply->sources & HttpMsg::srcUnsafe); + !(filled->reply->sources & Http::Message::srcUnsafe); return (safeRequest && safeReply) ? 1 : 0; } diff --git a/src/adaptation/Answer.cc b/src/adaptation/Answer.cc index 76bd568421..5164a1756b 100644 --- a/src/adaptation/Answer.cc +++ b/src/adaptation/Answer.cc @@ -11,6 +11,7 @@ #include "squid.h" #include "adaptation/Answer.h" #include "base/AsyncJobCalls.h" +#include "http/Message.h" Adaptation::Answer Adaptation::Answer::Error(bool final) @@ -22,7 +23,7 @@ Adaptation::Answer::Error(bool final) } Adaptation::Answer -Adaptation::Answer::Forward(HttpMsg *aMsg) +Adaptation::Answer::Forward(Http::Message *aMsg) { Answer answer(akForward); answer.message = aMsg; diff --git a/src/adaptation/Answer.h b/src/adaptation/Answer.h index 2c38597d4f..c2a5cb70df 100644 --- a/src/adaptation/Answer.h +++ b/src/adaptation/Answer.h @@ -10,7 +10,8 @@ #define SQUID_ADAPTATION__ANSWER_H #include "adaptation/forward.h" -#include "HttpMsg.h" +#include "http/forward.h" +#include "SquidString.h" #include @@ -29,13 +30,13 @@ public: } Kind; static Answer Error(bool final); ///< create an akError answer - static Answer Forward(HttpMsg *aMsg); ///< create an akForward answer + static Answer Forward(Http::Message *aMsg); ///< create an akForward answer static Answer Block(const String &aRule); ///< create an akBlock answer std::ostream &print(std::ostream &os) const; public: - HttpMsg::Pointer message; ///< HTTP request or response to forward + Http::MessagePointer message; ///< HTTP request or response to forward String ruleId; ///< ACL (or similar rule) name that blocked forwarding bool final; ///< whether the error, if any, cannot be bypassed Kind kind; ///< the type of the answer diff --git a/src/adaptation/Initiate.cc b/src/adaptation/Initiate.cc index d3ac320e7f..10df0cebf6 100644 --- a/src/adaptation/Initiate.cc +++ b/src/adaptation/Initiate.cc @@ -13,7 +13,7 @@ #include "adaptation/Initiate.h" #include "adaptation/Initiator.h" #include "base/AsyncJobCalls.h" -#include "HttpMsg.h" +#include "http/Message.h" namespace Adaptation { diff --git a/src/adaptation/Iterator.cc b/src/adaptation/Iterator.cc index e32f38bad0..3c37879987 100644 --- a/src/adaptation/Iterator.cc +++ b/src/adaptation/Iterator.cc @@ -16,13 +16,11 @@ #include "adaptation/ServiceFilter.h" #include "adaptation/ServiceGroups.h" #include "base/TextException.h" -#include "HttpMsg.h" #include "HttpReply.h" -#include "HttpRequest.h" #include "sbuf/StringConvert.h" Adaptation::Iterator::Iterator( - HttpMsg *aMsg, HttpRequest *aCause, + Http::Message *aMsg, HttpRequest *aCause, AccessLogEntry::Pointer &alp, const ServiceGroupPointer &aGroup): AsyncJob("Iterator"), @@ -118,7 +116,7 @@ Adaptation::Iterator::noteAdaptationAnswer(const Answer &answer) { switch (answer.kind) { case Answer::akForward: - handleAdaptedHeader(const_cast(answer.message.getRaw())); + handleAdaptedHeader(const_cast(answer.message.getRaw())); break; case Answer::akBlock: @@ -132,7 +130,7 @@ Adaptation::Iterator::noteAdaptationAnswer(const Answer &answer) } void -Adaptation::Iterator::handleAdaptedHeader(HttpMsg *aMsg) +Adaptation::Iterator::handleAdaptedHeader(Http::Message *aMsg) { // set theCause if we switched to request satisfaction mode if (!theCause) { // probably sent a request message diff --git a/src/adaptation/Iterator.h b/src/adaptation/Iterator.h index fd2f5f5d4f..c451f2acdd 100644 --- a/src/adaptation/Iterator.h +++ b/src/adaptation/Iterator.h @@ -13,9 +13,7 @@ #include "adaptation/Initiate.h" #include "adaptation/Initiator.h" #include "adaptation/ServiceGroups.h" - -class HttpMsg; -class HttpRequest; +#include "http/forward.h" namespace Adaptation { @@ -35,7 +33,7 @@ class Iterator: public Initiate, public Initiator CBDATA_CLASS(Iterator); public: - Iterator(HttpMsg *virginHeader, HttpRequest *virginCause, + Iterator(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServiceGroupPointer &aGroup); virtual ~Iterator(); @@ -61,13 +59,13 @@ protected: /// creates service filter for the current step ServiceFilter filter() const; - void handleAdaptedHeader(HttpMsg *msg); + void handleAdaptedHeader(Http::Message *msg); void handleAdaptationBlock(const Answer &answer); void handleAdaptationError(bool final); ServiceGroupPointer theGroup; ///< the service group we are iterating ServicePlan thePlan; ///< which services to use and in what order - HttpMsg *theMsg; ///< the message being adapted (virgin for each step) + Http::Message *theMsg; ///< the message being adapted (virgin for each step) HttpRequest *theCause; ///< the cause of the original virgin message AccessLogEntry::Pointer al; ///< info for the future access.log entry CbcPointer theLauncher; ///< current transaction launcher diff --git a/src/adaptation/Message.cc b/src/adaptation/Message.cc index e0638e43cd..1e7791dca5 100644 --- a/src/adaptation/Message.cc +++ b/src/adaptation/Message.cc @@ -11,7 +11,8 @@ #include "squid.h" #include "adaptation/Message.h" #include "base/TextException.h" -#include "HttpMsg.h" +#include "BodyPipe.h" +#include "http/Message.h" Adaptation::Message::Message(): header(NULL) { diff --git a/src/adaptation/Message.h b/src/adaptation/Message.h index ba52d82dcb..9b58fb3db7 100644 --- a/src/adaptation/Message.h +++ b/src/adaptation/Message.h @@ -10,8 +10,8 @@ #define SQUID__ADAPTATION__MESSAGE_H #include "base/RefCount.h" +#include "http/forward.h" -class HttpMsg; class BodyPipe; typedef RefCount BodyPipePointer; @@ -21,12 +21,12 @@ namespace Adaptation // Manages the header and the body of an HTTP message being worked on. // Adaptation transactions use this class for virgin and adapted HTTP messages. // TODO: remove this class after adding refcounted message pointers and -// after making sure nobody abruptly clears the HttpMsg::body_pipe pointer. +// after making sure nobody abruptly clears the Http::Message::body_pipe pointer. class Message { public: - typedef HttpMsg Header; + typedef Http::Message Header; Message(); Message(Header *aHeader); diff --git a/src/adaptation/Service.h b/src/adaptation/Service.h index 6e3f3fea6d..eb6d8a4d98 100644 --- a/src/adaptation/Service.h +++ b/src/adaptation/Service.h @@ -14,13 +14,11 @@ #include "adaptation/forward.h" #include "adaptation/ServiceConfig.h" #include "base/RefCount.h" +#include "http/forward.h" #include "SquidString.h" // TODO: Move src/ICAP/ICAPServiceRep.h API comments here and update them -class HttpMsg; -class HttpRequest; - namespace Adaptation { @@ -40,7 +38,7 @@ public: virtual bool broken() const; virtual bool up() const = 0; // see comments above - virtual Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) = 0; + virtual Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp) = 0; bool wants(const ServiceFilter &filter) const; diff --git a/src/adaptation/ecap/MessageRep.cc b/src/adaptation/ecap/MessageRep.cc index 99a1c151dc..fdd890c9c9 100644 --- a/src/adaptation/ecap/MessageRep.cc +++ b/src/adaptation/ecap/MessageRep.cc @@ -24,7 +24,7 @@ /* HeaderRep */ -Adaptation::Ecap::HeaderRep::HeaderRep(HttpMsg &aMessage): theHeader(aMessage.header), +Adaptation::Ecap::HeaderRep::HeaderRep(Http::Message &aMessage): theHeader(aMessage.header), theMessage(aMessage) { } @@ -112,7 +112,7 @@ Adaptation::Ecap::HeaderRep::TranslateHeaderId(const Name &name) /* FirstLineRep */ -Adaptation::Ecap::FirstLineRep::FirstLineRep(HttpMsg &aMessage): theMessage(aMessage) +Adaptation::Ecap::FirstLineRep::FirstLineRep(Http::Message &aMessage): theMessage(aMessage) { } @@ -359,7 +359,7 @@ Adaptation::Ecap::BodyRep::bodySize() const /* MessageRep */ -Adaptation::Ecap::MessageRep::MessageRep(HttpMsg *rawHeader): +Adaptation::Ecap::MessageRep::MessageRep(Http::Message *rawHeader): theMessage(rawHeader), theFirstLineRep(NULL), theHeaderRep(NULL), theBodyRep(NULL) { @@ -388,7 +388,7 @@ Adaptation::Ecap::MessageRep::~MessageRep() libecap::shared_ptr Adaptation::Ecap::MessageRep::clone() const { - HttpMsg *hdr = theMessage.header->clone(); + Http::Message *hdr = theMessage.header->clone(); hdr->body_pipe = NULL; // if any; TODO: remove pipe cloning from ::clone? libecap::shared_ptr res(new MessageRep(hdr)); diff --git a/src/adaptation/ecap/MessageRep.h b/src/adaptation/ecap/MessageRep.h index 5e9579e63b..03d830df16 100644 --- a/src/adaptation/ecap/MessageRep.h +++ b/src/adaptation/ecap/MessageRep.h @@ -15,15 +15,13 @@ #include "adaptation/Message.h" #include "anyp/ProtocolType.h" #include "BodyPipe.h" +#include "http/forward.h" #include "HttpHeader.h" + #include #include #include -class HttpMsg; -class HttpRequest; -class HttpReply; - namespace Adaptation { namespace Ecap @@ -31,7 +29,7 @@ namespace Ecap class XactionRep; -// Translates Squid HttpMsg into libecap::Header. +// Translates Squid Http::Message into libecap::Header. class HeaderRep: public libecap::Header { public: @@ -39,7 +37,7 @@ public: typedef libecap::Area Area; public: - HeaderRep(HttpMsg &aMessage); + HeaderRep(Http::Message &aMessage); /* libecap::Header API */ virtual bool hasAny(const Name &name) const; @@ -55,17 +53,17 @@ protected: private: HttpHeader &theHeader; // the header being translated to libecap - HttpMsg &theMessage; // the message being translated to libecap + Http::Message &theMessage; // the message being translated to libecap }; -// Helps translate Squid HttpMsg into libecap::FirstLine (see children). +// Helps translate Squid Http::Message into libecap::FirstLine (see children). class FirstLineRep { public: typedef libecap::Name Name; public: - FirstLineRep(HttpMsg &aMessage); + FirstLineRep(Http::Message &aMessage); libecap::Version version() const; void version(const libecap::Version &aVersion); @@ -76,7 +74,7 @@ protected: static AnyP::ProtocolType TranslateProtocolId(const Name &name); private: - HttpMsg &theMessage; // the message which first line is being translated + Http::Message &theMessage; // the message which first line is being translated }; // Translates Squid HttpRequest into libecap::RequestLine. @@ -149,7 +147,7 @@ private: class MessageRep: public libecap::Message { public: - explicit MessageRep(HttpMsg *rawHeader); + explicit MessageRep(Http::Message *rawHeader); virtual ~MessageRep(); /* libecap::Message API */ diff --git a/src/adaptation/ecap/ServiceRep.cc b/src/adaptation/ecap/ServiceRep.cc index 94c2f4ef0e..7983d06912 100644 --- a/src/adaptation/ecap/ServiceRep.cc +++ b/src/adaptation/ecap/ServiceRep.cc @@ -248,7 +248,7 @@ bool Adaptation::Ecap::ServiceRep::wantsUrl(const SBuf &urlPath) const } Adaptation::Initiate * -Adaptation::Ecap::ServiceRep::makeXactLauncher(HttpMsg *virgin, +Adaptation::Ecap::ServiceRep::makeXactLauncher(Http::Message *virgin, HttpRequest *cause, AccessLogEntry::Pointer &alp) { Must(up()); diff --git a/src/adaptation/ecap/ServiceRep.h b/src/adaptation/ecap/ServiceRep.h index b4c9256114..4927d17349 100644 --- a/src/adaptation/ecap/ServiceRep.h +++ b/src/adaptation/ecap/ServiceRep.h @@ -37,7 +37,7 @@ public: virtual void finalize(); virtual bool probed() const; virtual bool up() const; - virtual Adaptation::Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp); + virtual Adaptation::Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp); virtual bool wantsUrl(const SBuf &urlPath) const; virtual void noteFailure(); virtual const char *status() const; diff --git a/src/adaptation/ecap/XactionRep.cc b/src/adaptation/ecap/XactionRep.cc index 5189f50e9a..0645a71e8b 100644 --- a/src/adaptation/ecap/XactionRep.cc +++ b/src/adaptation/ecap/XactionRep.cc @@ -45,7 +45,7 @@ public: }; Adaptation::Ecap::XactionRep::XactionRep( - HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, + Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServicePointer &aService): AsyncJob("Adaptation::Ecap::XactionRep"), Adaptation::Initiate("Adaptation::Ecap::XactionRep"), @@ -401,7 +401,7 @@ Adaptation::Ecap::XactionRep::useVirgin() preserveVb("useVirgin"); - HttpMsg *clone = theVirginRep.raw().header->clone(); + Http::Message *clone = theVirginRep.raw().header->clone(); // check that clone() copies the pipe so that we do not have to Must(!theVirginRep.raw().header->body_pipe == !clone->body_pipe); @@ -418,7 +418,7 @@ Adaptation::Ecap::XactionRep::useAdapted(const libecap::shared_ptrbody()) { // final, bodyless answer proxyingAb = opNever; @@ -457,7 +457,7 @@ Adaptation::Ecap::XactionRep::blockVirgin() /// Called just before sendAnswer() to record adapter meta-information /// which may affect answer processing and may be needed for logging. void -Adaptation::Ecap::XactionRep::updateHistory(HttpMsg *adapted) +Adaptation::Ecap::XactionRep::updateHistory(Http::Message *adapted) { if (!theMaster) // all updates rely on being able to query the adapter return; @@ -734,8 +734,8 @@ Adaptation::Ecap::XactionRep::status() const } void -Adaptation::Ecap::XactionRep::updateSources(HttpMsg *adapted) +Adaptation::Ecap::XactionRep::updateSources(Http::Message *adapted) { - adapted->sources |= service().cfg().connectionEncryption ? HttpMsg::srcEcaps : HttpMsg::srcEcap; + adapted->sources |= service().cfg().connectionEncryption ? Http::Message::srcEcaps : Http::Message::srcEcap; } diff --git a/src/adaptation/ecap/XactionRep.h b/src/adaptation/ecap/XactionRep.h index 481b42c17e..d6111d16c9 100644 --- a/src/adaptation/ecap/XactionRep.h +++ b/src/adaptation/ecap/XactionRep.h @@ -35,7 +35,7 @@ class XactionRep : public Adaptation::Initiate, public libecap::host::Xaction, CBDATA_CLASS(XactionRep); public: - XactionRep(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServicePointer &service); + XactionRep(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServicePointer &service); virtual ~XactionRep(); typedef libecap::shared_ptr AdapterXaction; @@ -91,10 +91,10 @@ protected: void moveAbContent(); - void updateHistory(HttpMsg *adapted); + void updateHistory(Http::Message *adapted); void terminateMaster(); void scheduleStop(const char *reason); - void updateSources(HttpMsg *adapted); + void updateSources(Http::Message *adapted); const libecap::Area clientIpValue() const; const libecap::Area usernameValue() const; diff --git a/src/adaptation/icap/InOut.h b/src/adaptation/icap/InOut.h index 9aca3e39a2..b7689068b1 100644 --- a/src/adaptation/icap/InOut.h +++ b/src/adaptation/icap/InOut.h @@ -9,9 +9,7 @@ #ifndef SQUID_ICAPINOUT_H #define SQUID_ICAPINOUT_H -#include "HttpMsg.h" #include "HttpReply.h" -#include "HttpRequest.h" // IcapInOut manages a pointer to the HTTP message being worked on. // For HTTP responses, request header information is also available @@ -27,7 +25,8 @@ class InOut { public: - typedef HttpMsg Header; + // TODO: s/Header/Message/i ? + typedef Http::Message Header; InOut(): header(0), cause(0) {} @@ -64,8 +63,6 @@ public: BodyPipe::Pointer body_pipe; }; -// TODO: s/Header/Message/i ? - } // namespace Icap } // namespace Adaptation diff --git a/src/adaptation/icap/Launcher.cc b/src/adaptation/icap/Launcher.cc index a1cdde35e1..4b9c51d213 100644 --- a/src/adaptation/icap/Launcher.cc +++ b/src/adaptation/icap/Launcher.cc @@ -17,9 +17,7 @@ #include "adaptation/icap/Xaction.h" #include "base/TextException.h" #include "globals.h" -#include "HttpMsg.h" #include "HttpReply.h" -#include "HttpRequest.h" Adaptation::Icap::Launcher::Launcher(const char *aTypeName, Adaptation::ServicePointer &aService): diff --git a/src/adaptation/icap/ModXact.cc b/src/adaptation/icap/ModXact.cc index cbfc9ac412..9ed17fb798 100644 --- a/src/adaptation/icap/ModXact.cc +++ b/src/adaptation/icap/ModXact.cc @@ -27,9 +27,7 @@ #include "err_detail_type.h" #include "http/one/TeChunkedParser.h" #include "HttpHeaderTools.h" -#include "HttpMsg.h" #include "HttpReply.h" -#include "HttpRequest.h" #include "SquidTime.h" #include "URL.h" @@ -49,7 +47,7 @@ Adaptation::Icap::ModXact::State::State() memset(this, 0, sizeof(*this)); } -Adaptation::Icap::ModXact::ModXact(HttpMsg *virginHeader, +Adaptation::Icap::ModXact::ModXact(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, Adaptation::Icap::ServiceRep::Pointer &aService): AsyncJob("Adaptation::Icap::ModXact"), Adaptation::Icap::Xaction("Adaptation::Icap::ModXact", aService), @@ -777,9 +775,9 @@ void Adaptation::Icap::ModXact::startSending() echoMore(); else { // If we are not using the virgin HTTP object update the - // HttpMsg::sources flag. + // Http::Message::sources flag. // The state.sending may set to State::sendingVirgin in the case - // of 206 responses too, where we do not want to update HttpMsg::sources + // of 206 responses too, where we do not want to update Http::Message::sources // flag. However even for 206 responses the state.sending is // not set yet to sendingVirgin. This is done in later step // after the parseBody method called. @@ -953,12 +951,12 @@ void Adaptation::Icap::ModXact::prepEchoing() setOutcome(xoEcho); // We want to clone the HTTP message, but we do not want - // to copy some non-HTTP state parts that HttpMsg kids carry in them. + // to copy some non-HTTP state parts that Http::Message kids carry in them. // Thus, we cannot use a smart pointer, copy constructor, or equivalent. // Instead, we simply write the HTTP message and "clone" it by parsing. - // TODO: use HttpMsg::clone()! + // TODO: use Http::Message::clone()! - HttpMsg *oldHead = virgin.header; + Http::Message *oldHead = virgin.header; debugs(93, 7, HERE << "cloning virgin message " << oldHead); MemBuf httpBuf; @@ -970,7 +968,7 @@ void Adaptation::Icap::ModXact::prepEchoing() // allocate the adapted message and copy metainfo Must(!adapted.header); { - HttpMsg::Pointer newHead; + Http::MessagePointer newHead; if (dynamic_cast(oldHead)) { newHead = new HttpRequest; } else if (dynamic_cast(oldHead)) { @@ -986,7 +984,7 @@ void Adaptation::Icap::ModXact::prepEchoing() // parse the buffer back Http::StatusCode error = Http::scNone; - httpBuf.terminate(); // HttpMsg::parse requires nil-terminated buffer + httpBuf.terminate(); // Http::Message::parse requires nil-terminated buffer Must(adapted.header->parse(httpBuf.content(), httpBuf.contentSize(), true, &error)); Must(adapted.header->hdr_sz == httpBuf.contentSize()); // no leftovers @@ -1094,7 +1092,7 @@ bool Adaptation::Icap::ModXact::parsePart(Part *part, const char *description) debugs(93, 5, "have " << readBuf.length() << ' ' << description << " bytes to parse; state: " << state.parsing); Http::StatusCode error = Http::scNone; // XXX: performance regression. c_str() data copies - // XXX: HttpMsg::parse requires a terminated string buffer + // XXX: Http::Message::parse requires a terminated string buffer const char *tmpBuf = readBuf.c_str(); const bool parsed = part->parse(tmpBuf, readBuf.length(), commEof, &error); debugs(93, (!parsed && error) ? 2 : 5, description << " parsing result: " << parsed << " detail: " << error); @@ -1105,7 +1103,8 @@ bool Adaptation::Icap::ModXact::parsePart(Part *part, const char *description) } // parses both HTTP and ICAP headers -bool Adaptation::Icap::ModXact::parseHead(HttpMsg *head) +bool +Adaptation::Icap::ModXact::parseHead(Http::Message *head) { if (!parsePart(head, "head")) { head->reset(); @@ -1348,7 +1347,7 @@ void Adaptation::Icap::ModXact::finalizeLogInfo() #endif al.cache.code = h->logType; - const HttpMsg *virgin_msg = dynamic_cast(virgin.header); + const Http::Message *virgin_msg = dynamic_cast(virgin.header); if (!virgin_msg) virgin_msg = virgin_request_; assert(virgin_msg != virgin.cause); @@ -1450,7 +1449,7 @@ void Adaptation::Icap::ModXact::makeRequestHeaders(MemBuf &buf) } if (ICAP::methodRespmod == m) - if (const HttpMsg *prime = virgin.header) + if (const Http::Message *prime = virgin.header) encapsulateHead(buf, "res-hdr", httpBuf, prime); if (!virginBody.expected()) @@ -1584,17 +1583,18 @@ void Adaptation::Icap::ModXact::makeUsernameHeader(const HttpRequest *request, M #endif } -void Adaptation::Icap::ModXact::encapsulateHead(MemBuf &icapBuf, const char *section, MemBuf &httpBuf, const HttpMsg *head) +void +Adaptation::Icap::ModXact::encapsulateHead(MemBuf &icapBuf, const char *section, MemBuf &httpBuf, const Http::Message *head) { // update ICAP header icapBuf.appendf("%s=%d, ", section, (int) httpBuf.contentSize()); // begin cloning - HttpMsg::Pointer headClone; + Http::MessagePointer headClone; if (const HttpRequest* old_request = dynamic_cast(head)) { HttpRequest::Pointer new_request(new HttpRequest); - // copy the requst-line details + // copy the request-line details new_request->method = old_request->method; new_request->url = old_request->url; new_request->http_ver = old_request->http_ver; @@ -1624,7 +1624,8 @@ void Adaptation::Icap::ModXact::encapsulateHead(MemBuf &icapBuf, const char *sec // headClone unlocks and, hence, deletes the message we packed } -void Adaptation::Icap::ModXact::packHead(MemBuf &httpBuf, const HttpMsg *head) +void +Adaptation::Icap::ModXact::packHead(MemBuf &httpBuf, const Http::Message *head) { head->packInto(&httpBuf, true); } @@ -1819,7 +1820,7 @@ void Adaptation::Icap::ModXact::estimateVirginBody() { // note: lack of size info may disable previews and 204s - HttpMsg *msg = virgin.header; + Http::Message *msg = virgin.header; Must(msg); HttpRequestMethod method; @@ -2014,12 +2015,12 @@ void Adaptation::Icap::ModXact::clearError() void Adaptation::Icap::ModXact::updateSources() { Must(adapted.header); - adapted.header->sources |= (service().cfg().connectionEncryption ? HttpMsg::srcIcaps : HttpMsg::srcIcap); + adapted.header->sources |= (service().cfg().connectionEncryption ? Http::Message::srcIcaps : Http::Message::srcIcap); } /* Adaptation::Icap::ModXactLauncher */ -Adaptation::Icap::ModXactLauncher::ModXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, Adaptation::ServicePointer aService): +Adaptation::Icap::ModXactLauncher::ModXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, Adaptation::ServicePointer aService): AsyncJob("Adaptation::Icap::ModXactLauncher"), Adaptation::Icap::Launcher("Adaptation::Icap::ModXactLauncher", aService), al(alp) diff --git a/src/adaptation/icap/ModXact.h b/src/adaptation/icap/ModXact.h index fdac7a0e98..1fd220c348 100644 --- a/src/adaptation/icap/ModXact.h +++ b/src/adaptation/icap/ModXact.h @@ -125,7 +125,7 @@ class ModXact: public Xaction, public BodyProducer, public BodyConsumer CBDATA_CLASS(ModXact); public: - ModXact(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, ServiceRep::Pointer &s); + ModXact(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, ServiceRep::Pointer &s); virtual ~ModXact(); // BodyProducer methods @@ -217,7 +217,7 @@ private: void parseHeaders(); void parseIcapHead(); void parseHttpHead(); - bool parseHead(HttpMsg *head); + bool parseHead(Http::Message *head); void decideOnParsingBody(); void parseBody(); @@ -239,7 +239,7 @@ private: void prepEchoing(); void prepPartialBodyEchoing(uint64_t pos); void echoMore(); - void updateSources(); ///< Update the HttpMsg sources + void updateSources(); ///< Update the Http::Message sources virtual bool doneAll() const; virtual void swanSong(); @@ -262,8 +262,8 @@ private: template bool parsePart(Part *part, const char *description); - void packHead(MemBuf &httpBuf, const HttpMsg *head); - void encapsulateHead(MemBuf &icapBuf, const char *section, MemBuf &httpBuf, const HttpMsg *head); + void packHead(MemBuf &httpBuf, const Http::Message *head); + void encapsulateHead(MemBuf &icapBuf, const char *section, MemBuf &httpBuf, const Http::Message *head); bool gotEncapsulated(const char *section) const; /// whether ICAP response header indicates HTTP header presence bool expectHttpHeader() const; @@ -359,7 +359,7 @@ class ModXactLauncher: public Launcher CBDATA_CLASS(ModXactLauncher); public: - ModXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, Adaptation::ServicePointer s); + ModXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, Adaptation::ServicePointer s); protected: virtual Xaction *createXaction(); diff --git a/src/adaptation/icap/OptXact.cc b/src/adaptation/icap/OptXact.cc index fcce63ee3b..7ea7465a71 100644 --- a/src/adaptation/icap/OptXact.cc +++ b/src/adaptation/icap/OptXact.cc @@ -69,7 +69,7 @@ void Adaptation::Icap::OptXact::makeRequest(MemBuf &buf) // XXX: HttpRequest cannot fully parse ICAP Request-Line Http::StatusCode reqStatus; - buf.terminate(); // HttpMsg::parse requires terminated buffer + buf.terminate(); // Http::Message::parse requires terminated buffer Must(icapRequest->parse(buf.content(), buf.contentSize(), true, &reqStatus) > 0); } diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index 192d4655cb..d9fd5a8367 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -555,7 +555,7 @@ void Adaptation::Icap::ServiceRep::noteAdaptationAnswer(const Answer &answer) } Must(answer.kind == Answer::akForward); // no akBlock for OPTIONS requests - const HttpMsg *msg = answer.message.getRaw(); + const Http::Message *msg = answer.message.getRaw(); Must(msg); debugs(93,5, HERE << "is interpreting new options " << status()); @@ -677,7 +677,7 @@ Adaptation::Icap::ServiceRep::optionsFetchTime() const } Adaptation::Initiate * -Adaptation::Icap::ServiceRep::makeXactLauncher(HttpMsg *virgin, +Adaptation::Icap::ServiceRep::makeXactLauncher(Http::Message *virgin, HttpRequest *cause, AccessLogEntry::Pointer &alp) { return new Adaptation::Icap::ModXactLauncher(virgin, cause, alp, this); diff --git a/src/adaptation/icap/ServiceRep.h b/src/adaptation/icap/ServiceRep.h index d08737cf6d..6906170137 100644 --- a/src/adaptation/icap/ServiceRep.h +++ b/src/adaptation/icap/ServiceRep.h @@ -75,7 +75,7 @@ public: bool availableForNew() const; ///< a new transaction may start communicating with the service bool availableForOld() const; ///< a transaction notified about connection slot availability may start communicating with the service - virtual Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp); + virtual Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp); void callWhenAvailable(AsyncCall::Pointer &cb, bool priority = false); void callWhenReady(AsyncCall::Pointer &cb); diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index cb9b4bfa40..cb15486998 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -24,9 +24,7 @@ #include "fde.h" #include "FwdState.h" #include "globals.h" -#include "HttpMsg.h" #include "HttpReply.h" -#include "HttpRequest.h" #include "icap_log.h" #include "ipcache.h" #include "pconn.h" @@ -522,7 +520,8 @@ void Adaptation::Icap::Xaction::cancelRead() } } -bool Adaptation::Icap::Xaction::parseHttpMsg(HttpMsg *msg) +bool +Adaptation::Icap::Xaction::parseHttpMsg(Http::Message *msg) { debugs(93, 5, "have " << readBuf.length() << " head bytes to parse"); diff --git a/src/adaptation/icap/Xaction.h b/src/adaptation/icap/Xaction.h index 73da61f953..6a7e7fc61a 100644 --- a/src/adaptation/icap/Xaction.h +++ b/src/adaptation/icap/Xaction.h @@ -86,7 +86,7 @@ protected: void cancelRead(); - bool parseHttpMsg(HttpMsg *msg); // true=success; false=needMore; throw=err + bool parseHttpMsg(Http::Message *msg); // true=success; false=needMore; throw=err bool mayReadMore() const; virtual bool doneReading() const; diff --git a/src/auth/basic/UserRequest.cc b/src/auth/basic/UserRequest.cc index cbd59a6f73..529e858711 100644 --- a/src/auth/basic/UserRequest.cc +++ b/src/auth/basic/UserRequest.cc @@ -17,7 +17,6 @@ #include "format/Format.h" #include "helper.h" #include "helper/Reply.h" -#include "HttpMsg.h" #include "HttpRequest.h" #include "MemBuf.h" #include "rfc1738.h" diff --git a/src/auth/ntlm/UserRequest.cc b/src/auth/ntlm/UserRequest.cc index 882173255a..e2680e98b0 100644 --- a/src/auth/ntlm/UserRequest.cc +++ b/src/auth/ntlm/UserRequest.cc @@ -21,7 +21,6 @@ #include "helper.h" #include "helper/Reply.h" #include "http/Stream.h" -#include "HttpMsg.h" #include "HttpRequest.h" #include "MemBuf.h" #include "SquidTime.h" diff --git a/src/client_side.cc b/src/client_side.cc index 6881e041ee..4a52cf4870 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1641,8 +1641,8 @@ clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, // TODO: decouple http->flags.accel from request->flags.sslBumped request->flags.noDirect = (request->flags.accelerated && !request->flags.sslBumped) ? !conn->port->allow_direct : 0; - request->sources |= isFtp ? HttpMsg::srcFtp : - ((request->flags.sslBumped || conn->port->transport.protocol == AnyP::PROTO_HTTPS) ? HttpMsg::srcHttps : HttpMsg::srcHttp); + request->sources |= isFtp ? Http::Message::srcFtp : + ((request->flags.sslBumped || conn->port->transport.protocol == AnyP::PROTO_HTTPS) ? Http::Message::srcHttps : Http::Message::srcHttp); #if USE_AUTH if (request->flags.sslBumped) { if (conn->getAuth() != NULL) @@ -1695,7 +1695,7 @@ clientProcessRequest(ConnStateData *conn, const Http1::RequestParserPointer &hp, request->myportname = conn->port->name; if (!isFtp) { - // XXX: for non-HTTP messages instantiate a different HttpMsg child type + // XXX: for non-HTTP messages instantiate a different Http::Message child type // for now Squid only supports HTTP requests const AnyP::ProtocolVersion &http_ver = hp->messageProtocol(); assert(request->http_ver.protocol == http_ver.protocol); @@ -3430,7 +3430,7 @@ ConnStateData::buildFakeRequest(Http::MethodType const method, SBuf &useHost, un request->header.putStr(Http::HOST, useHost.c_str()); request->flags.intercepted = ((clientConnection->flags & COMM_INTERCEPTION) != 0); request->flags.interceptTproxy = ((clientConnection->flags & COMM_TRANSPARENT) != 0 ); - request->sources |= ((switchedToHttps() || port->transport.protocol == AnyP::PROTO_HTTPS) ? HttpMsg::srcHttps : HttpMsg::srcHttp); + request->sources |= ((switchedToHttps() || port->transport.protocol == AnyP::PROTO_HTTPS) ? Http::Message::srcHttps : Http::Message::srcHttp); #if USE_AUTH if (getAuth()) request->auth_user_request = getAuth(); diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 1d9f9b4530..d2940097fa 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1883,7 +1883,7 @@ ClientHttpRequest::noteAdaptationAnswer(const Adaptation::Answer &answer) switch (answer.kind) { case Adaptation::Answer::akForward: - handleAdaptedHeader(const_cast(answer.message.getRaw())); + handleAdaptedHeader(const_cast(answer.message.getRaw())); break; case Adaptation::Answer::akBlock: @@ -1897,7 +1897,7 @@ ClientHttpRequest::noteAdaptationAnswer(const Adaptation::Answer &answer) } void -ClientHttpRequest::handleAdaptedHeader(HttpMsg *msg) +ClientHttpRequest::handleAdaptedHeader(Http::Message *msg) { assert(msg); diff --git a/src/client_side_request.h b/src/client_side_request.h index df6462a6d2..c515ca7c3f 100644 --- a/src/client_side_request.h +++ b/src/client_side_request.h @@ -13,6 +13,7 @@ #include "acl/forward.h" #include "client_side.h" #include "clientStream.h" +#include "http/forward.h" #include "HttpHeaderRange.h" #include "LogTags.h" #include "Store.h" @@ -20,7 +21,6 @@ #if USE_ADAPTATION #include "adaptation/forward.h" #include "adaptation/Initiator.h" -class HttpMsg; #endif class ClientRequestContext; @@ -168,7 +168,7 @@ private: // Adaptation::Initiator API virtual void noteAdaptationAnswer(const Adaptation::Answer &answer); - void handleAdaptedHeader(HttpMsg *msg); + void handleAdaptedHeader(Http::Message *msg); void handleAdaptationBlock(const Adaptation::Answer &answer); virtual void noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer group); diff --git a/src/clients/Client.cc b/src/clients/Client.cc index 807ae3b3b3..8706157252 100644 --- a/src/clients/Client.cc +++ b/src/clients/Client.cc @@ -464,7 +464,7 @@ sameUrlHosts(const char *url1, const char *url2) // purges entries that match the value of a given HTTP [response] header static void -purgeEntriesByHeader(HttpRequest *req, const char *reqUrl, HttpMsg *rep, Http::HdrType hdr) +purgeEntriesByHeader(HttpRequest *req, const char *reqUrl, Http::Message *rep, Http::HdrType hdr) { const char *hdrUrl, *absUrl; @@ -681,7 +681,7 @@ Client::noteAdaptationAnswer(const Adaptation::Answer &answer) switch (answer.kind) { case Adaptation::Answer::akForward: - handleAdaptedHeader(const_cast(answer.message.getRaw())); + handleAdaptedHeader(const_cast(answer.message.getRaw())); break; case Adaptation::Answer::akBlock: @@ -695,7 +695,7 @@ Client::noteAdaptationAnswer(const Adaptation::Answer &answer) } void -Client::handleAdaptedHeader(HttpMsg *msg) +Client::handleAdaptedHeader(Http::Message *msg) { if (abortOnBadEntry("entry went bad while waiting for adapted headers")) { // If the adapted response has a body, the ICAP side needs to know diff --git a/src/clients/Client.h b/src/clients/Client.h index 8bc7d51bfd..89d538e643 100644 --- a/src/clients/Client.h +++ b/src/clients/Client.h @@ -13,15 +13,13 @@ #include "BodyPipe.h" #include "CommCalls.h" #include "FwdState.h" +#include "http/forward.h" #include "StoreIOBuffer.h" #if USE_ADAPTATION #include "adaptation/forward.h" #include "adaptation/Initiator.h" #endif -class HttpMsg; -class HttpReply; - /** * Client is a common base for classes such as HttpStateData and FtpStateData. * All such classes must be able to consume request bodies from a BodyPipe @@ -127,7 +125,7 @@ protected: void handleAdaptedBodyProductionEnded(); void handleAdaptedBodyProducerAborted(); - void handleAdaptedHeader(HttpMsg *msg); + void handleAdaptedHeader(Http::Message *msg); void handleAdaptationCompleted(); void handleAdaptationBlocked(const Adaptation::Answer &answer); void handleAdaptationAborted(bool bypassable = false); diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc index 03ad932d9b..da0d5d2a09 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -27,7 +27,6 @@ #include "HttpHeader.h" #include "HttpHeaderRange.h" #include "HttpReply.h" -#include "HttpRequest.h" #include "ip/tools.h" #include "MemBuf.h" #include "mime.h" @@ -2616,7 +2615,7 @@ Ftp::Gateway::appendSuccessHeader() if (mime_enc) reply->header.putStr(Http::HdrType::CONTENT_ENCODING, mime_enc); - reply->sources |= HttpMsg::srcFtp; + reply->sources |= Http::Message::srcFtp; setVirginReply(reply); adaptOrFinalizeReply(); } diff --git a/src/clients/FtpRelay.cc b/src/clients/FtpRelay.cc index c702ad53ae..d97357c14d 100644 --- a/src/clients/FtpRelay.cc +++ b/src/clients/FtpRelay.cc @@ -377,7 +377,7 @@ Ftp::Relay::forwardReply() EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT); HttpReply *const reply = createHttpReply(Http::scNoContent); - reply->sources |= HttpMsg::srcFtp; + reply->sources |= Http::Message::srcFtp; setVirginReply(reply); adaptOrFinalizeReply(); @@ -450,7 +450,7 @@ Ftp::Relay::startDataDownload() " (" << data.conn->local << ")"); HttpReply *const reply = createHttpReply(Http::scOkay, -1); - reply->sources |= HttpMsg::srcFtp; + reply->sources |= Http::Message::srcFtp; EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT); setVirginReply(reply); diff --git a/src/format/Format.cc b/src/format/Format.cc index 8cf59dc37d..fb73afb0a6 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -335,10 +335,10 @@ sslErrorName(Security::ErrorCode err, char *buf, size_t size) /// \retval HttpReply sent to the HTTP client (access.log and default context). /// \retval HttpReply received (encapsulated) from the ICAP server (icap.log context). /// \retval HttpRequest received (encapsulated) from the ICAP server (icap.log context). -static const HttpMsg * +static const Http::Message * actualReplyHeader(const AccessLogEntry::Pointer &al) { - const HttpMsg *msg = al->reply; + const Http::Message *msg = al->reply; #if ICAP_CLIENT // al->icap.reqMethod is methodNone in access.log context if (!msg && al->icap.reqMethod == Adaptation::methodReqmod) @@ -349,7 +349,7 @@ actualReplyHeader(const AccessLogEntry::Pointer &al) /// XXX: Misnamed. See actualReplyHeader(). /// \return HttpRequest or HttpReply for %http::>h. -static const HttpMsg * +static const Http::Message * actualRequestHeader(const AccessLogEntry::Pointer &al) { #if ICAP_CLIENT @@ -628,7 +628,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS break; case LFT_REQUEST_HEADER: - if (const HttpMsg *msg = actualRequestHeader(al)) + if (const Http::Message *msg = actualRequestHeader(al)) sb = msg->header.getByName(fmt->data.header.header); out = sb.termedBuf(); @@ -649,7 +649,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS break; case LFT_REPLY_HEADER: { - if (const HttpMsg *msg = actualReplyHeader(al)) + if (const Http::Message *msg = actualReplyHeader(al)) sb = msg->header.getByName(fmt->data.header.header); out = sb.termedBuf(); @@ -838,7 +838,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS break; #endif case LFT_REQUEST_HEADER_ELEM: - if (const HttpMsg *msg = actualRequestHeader(al)) + if (const Http::Message *msg = actualRequestHeader(al)) sb = msg->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator); out = sb.termedBuf(); @@ -858,7 +858,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS break; case LFT_REPLY_HEADER_ELEM: { - if (const HttpMsg *msg = actualReplyHeader(al)) + if (const Http::Message *msg = actualReplyHeader(al)) sb = msg->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator); out = sb.termedBuf(); diff --git a/src/ftp/Elements.cc b/src/ftp/Elements.cc index e966c889ec..f322086472 100644 --- a/src/ftp/Elements.cc +++ b/src/ftp/Elements.cc @@ -15,7 +15,7 @@ #include "sbuf/SBuf.h" // FTP does not have a notion of a "protocol version" but we need something for -// compatibility with the current HttpMsg wrapping layer. We use version 1.1: +// compatibility with the current Http::Message wrapping layer. We use version 1.1: // * some ICAP services probably expect /1.0 or /1.1 when parsing HTTP headers; // * FTP commands are sent on a "persistent by default" connection, just like // HTTP/1.1. Using 1.1 leads to fewer exceptions in current code shared by diff --git a/src/ftp/Elements.h b/src/ftp/Elements.h index cf8e989a69..bee2daedc8 100644 --- a/src/ftp/Elements.h +++ b/src/ftp/Elements.h @@ -9,11 +9,10 @@ #ifndef SQUID_FTP_ELEMENTS_H #define SQUID_FTP_ELEMENTS_H +#include "http/forward.h" #include "http/StatusCode.h" #include "sbuf/forward.h" -class HttpReply; - namespace AnyP { class ProtocolVersion; @@ -22,7 +21,7 @@ class ProtocolVersion; namespace Ftp { -/// Protocol version to use in HttpMsg structures wrapping FTP messages. +/// Protocol version to use in Http::Message structures wrapping FTP messages. AnyP::ProtocolVersion ProtocolVersion(); /// Create an internal HttpReply structure to house FTP control response info. diff --git a/src/gopher.cc b/src/gopher.cc index 9064f1719c..fee738228c 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -777,7 +777,7 @@ gopherReadReply(const Comm::ConnectionPointer &conn, char *buf, size_t len, Comm if (req->hier.bodyBytesRead < 0) { req->hier.bodyBytesRead = 0; // first bytes read, update Reply flags: - gopherState->reply_->sources |= HttpMsg::srcGopher; + gopherState->reply_->sources |= Http::Message::srcGopher; } req->hier.bodyBytesRead += len; diff --git a/src/http.cc b/src/http.cc index ce24c6486b..5f31f9afe4 100644 --- a/src/http.cc +++ b/src/http.cc @@ -771,7 +771,7 @@ HttpStateData::processReplyHeader() // done with Parser, now process using the HttpReply hp = NULL; - newrep->sources |= request->url.getScheme() == AnyP::PROTO_HTTPS ? HttpMsg::srcHttps : HttpMsg::srcHttp; + newrep->sources |= request->url.getScheme() == AnyP::PROTO_HTTPS ? Http::Message::srcHttps : Http::Message::srcHttp; newrep->removeStaleWarnings(); diff --git a/src/http/Makefile.am b/src/http/Makefile.am index 72499fd23e..0527a13d7f 100644 --- a/src/http/Makefile.am +++ b/src/http/Makefile.am @@ -17,6 +17,8 @@ libhttp_la_SOURCES = \ ContentLengthInterpreter.cc \ ContentLengthInterpreter.h \ forward.h \ + Message.cc \ + Message.h \ MethodType.cc \ MethodType.h \ ProtocolVersion.h \ diff --git a/src/HttpMsg.cc b/src/http/Message.cc similarity index 80% rename from src/HttpMsg.cc rename to src/http/Message.cc index f6f2f8d819..4ba0c98d66 100644 --- a/src/HttpMsg.cc +++ b/src/http/Message.cc @@ -10,32 +10,27 @@ #include "squid.h" #include "Debug.h" +#include "http/Message.h" #include "http/one/Parser.h" #include "HttpHdrCc.h" #include "HttpHeaderTools.h" -#include "HttpMsg.h" #include "MemBuf.h" #include "mime_header.h" #include "profiler/Profiler.h" #include "SquidConfig.h" -HttpMsg::HttpMsg(http_hdr_owner_type owner): +Http::Message::Message(http_hdr_owner_type owner): http_ver(Http::ProtocolVersion()), - header(owner), - cache_control(NULL), - hdr_sz(0), - content_length(0), - pstate(psReadyToParseStartLine), - sources(0) + header(owner) {} -HttpMsg::~HttpMsg() +Http::Message::~Message() { assert(!body_pipe); } void -HttpMsg::putCc(const HttpHdrCc *otherCc) +Http::Message::putCc(const HttpHdrCc *otherCc) { // get rid of the old CC, if any if (cache_control) { @@ -88,7 +83,7 @@ httpMsgIsolateStart(const char **parse_start, const char **blk_start, const char // zero return means need more data // positive return is the size of parsed headers bool -HttpMsg::parse(const char *buf, const size_t sz, bool eof, Http::StatusCode *error) +Http::Message::parse(const char *buf, const size_t sz, bool eof, Http::StatusCode *error) { assert(error); *error = Http::scNone; @@ -107,13 +102,13 @@ HttpMsg::parse(const char *buf, const size_t sz, bool eof, Http::StatusCode *err } if (hdr_len > Config.maxReplyHeaderSize || (hdr_len <= 0 && sz > Config.maxReplyHeaderSize)) { - debugs(58, DBG_IMPORTANT, "HttpMsg::parse: Too large reply header (" << hdr_len << " > " << Config.maxReplyHeaderSize); + debugs(58, DBG_IMPORTANT, "Too large reply header (" << hdr_len << " > " << Config.maxReplyHeaderSize); *error = Http::scHeaderTooLarge; return false; } if (hdr_len <= 0) { - debugs(58, 3, "HttpMsg::parse: failed to find end of headers (eof: " << eof << ") in '" << buf << "'"); + debugs(58, 3, "failed to find end of headers (eof: " << eof << ") in '" << buf << "'"); if (eof) // iff we have seen the end, this is an error *error = Http::scInvalidHeader; @@ -124,22 +119,22 @@ HttpMsg::parse(const char *buf, const size_t sz, bool eof, Http::StatusCode *err const int res = httpMsgParseStep(buf, sz, eof); if (res < 0) { // error - debugs(58, 3, "HttpMsg::parse: cannot parse isolated headers in '" << buf << "'"); + debugs(58, 3, "cannot parse isolated headers in '" << buf << "'"); *error = Http::scInvalidHeader; return false; } if (res == 0) { - debugs(58, 2, "HttpMsg::parse: strange, need more data near '" << buf << "'"); + debugs(58, 2, "strange, need more data near '" << buf << "'"); *error = Http::scInvalidHeader; return false; // but this should not happen due to headersEnd() above } assert(res > 0); - debugs(58, 9, "HttpMsg::parse success (" << hdr_len << " bytes) near '" << buf << "'"); + debugs(58, 9, "success (" << hdr_len << " bytes) near '" << buf << "'"); if (hdr_sz != (int)hdr_len) { - debugs(58, DBG_IMPORTANT, "internal HttpMsg::parse vs. headersEnd error: " << + debugs(58, DBG_IMPORTANT, "internal Http::Message::parse vs. headersEnd error: " << hdr_sz << " != " << hdr_len); hdr_sz = (int)hdr_len; // because old http.cc code used hdr_len } @@ -147,16 +142,16 @@ HttpMsg::parse(const char *buf, const size_t sz, bool eof, Http::StatusCode *err return true; } -/* +/** * parseCharBuf() takes character buffer of HTTP headers (buf), - * which may not be NULL-terminated, and fills in an HttpMsg + * which may not be NULL-terminated, and fills in an Http::Message * structure. The parameter 'end' specifies the offset to * the end of the reply headers. The caller may know where the * end is, but is unable to NULL-terminate the buffer. This function * returns true on success. */ bool -HttpMsg::parseCharBuf(const char *buf, ssize_t end) +Http::Message::parseCharBuf(const char *buf, ssize_t end) { MemBuf mb; int success; @@ -170,15 +165,15 @@ HttpMsg::parseCharBuf(const char *buf, ssize_t end) return success == 1; } -/* - * parses a 0-terminating buffer into HttpMsg. - * Returns: - * 1 -- success - * 0 -- need more data (partial parse) - * -1 -- parse error +/** + * parses a 0-terminated buffer into Http::Message. + * + * \retval 1 success + * \retval 0 need more data (partial parse) + * \retval -1 parse error */ int -HttpMsg::httpMsgParseStep(const char *buf, int len, int atEnd) +Http::Message::httpMsgParseStep(const char *buf, int len, int atEnd) { const char *parse_start = buf; int parse_len = len; @@ -232,7 +227,7 @@ HttpMsg::httpMsgParseStep(const char *buf, int len, int atEnd) } bool -HttpMsg::parseHeader(Http1::Parser &hp) +Http::Message::parseHeader(Http1::Parser &hp) { // HTTP/1 message contains "zero or more header fields" // zero does not need parsing @@ -251,14 +246,14 @@ HttpMsg::parseHeader(Http1::Parser &hp) /* handy: resets and returns -1 */ int -HttpMsg::httpMsgParseError() +Http::Message::httpMsgParseError() { reset(); return -1; } void -HttpMsg::setContentLength(int64_t clen) +Http::Message::setContentLength(int64_t clen) { header.delById(Http::HdrType::CONTENT_LENGTH); // if any header.putInt64(Http::HdrType::CONTENT_LENGTH, clen); @@ -266,7 +261,7 @@ HttpMsg::setContentLength(int64_t clen) } bool -HttpMsg::persistent() const +Http::Message::persistent() const { if (http_ver > Http::ProtocolVersion(1,0)) { /* @@ -280,24 +275,25 @@ HttpMsg::persistent() const } } -void HttpMsg::packInto(Packable *p, bool full_uri) const +void +Http::Message::packInto(Packable *p, bool full_uri) const { packFirstLineInto(p, full_uri); header.packInto(p); p->append("\r\n", 2); } -void HttpMsg::hdrCacheInit() +void +Http::Message::hdrCacheInit() { content_length = header.getInt64(Http::HdrType::CONTENT_LENGTH); assert(NULL == cache_control); cache_control = header.getCc(); } -/* - * useful for debugging - */ -void HttpMsg::firstLineBuf(MemBuf& mb) +/// useful for debugging +void +Http::Message::firstLineBuf(MemBuf &mb) { packFirstLineInto(&mb, true); } diff --git a/src/HttpMsg.h b/src/http/Message.h similarity index 84% rename from src/HttpMsg.h rename to src/http/Message.h index 629b4259f4..6c4d1a2d0f 100644 --- a/src/HttpMsg.h +++ b/src/http/Message.h @@ -6,8 +6,8 @@ * Please see the COPYING and CONTRIBUTORS files for details. */ -#ifndef SQUID_HTTPMSG_H -#define SQUID_HTTPMSG_H +#ifndef SQUID_HTTP_MESSAGE_H +#define SQUID_HTTP_MESSAGE_H #include "base/Lock.h" #include "BodyPipe.h" @@ -17,12 +17,13 @@ #include "http/StatusCode.h" #include "HttpHeader.h" -/// common parts of HttpRequest and HttpReply -class HttpMsg : public RefCountable +namespace Http { +/// common parts of HttpRequest and HttpReply +class Message : public RefCountable +{ public: - typedef RefCount Pointer; /// Who may have created or modified this message? enum Sources { srcUnknown = 0, @@ -44,18 +45,18 @@ public: srcSafe = 0x0000FFFF ///< Safe sources mask }; - HttpMsg(http_hdr_owner_type owner); - virtual ~HttpMsg(); + Message(http_hdr_owner_type); + virtual ~Message(); virtual void reset() = 0; // will have body when http*Clean()s are gone - void packInto(Packable * p, bool full_uri) const; + void packInto(Packable *, bool full_uri) const; ///< produce a message copy, except for a few connection-specific settings - virtual HttpMsg *clone() const = 0; ///< \todo rename: not a true copy? + virtual Http::Message *clone() const = 0; // TODO rename: not a true copy? /// [re]sets Content-Length header and cached value - void setContentLength(int64_t clen); + void setContentLength(int64_t); /** * \retval true the message sender asks to keep the connection open. @@ -72,20 +73,22 @@ public: HttpHeader header; - HttpHdrCc *cache_control; + HttpHdrCc *cache_control = nullptr; /* Unsupported, writable, may disappear/change in the future * For replies, sums _stored_ status-line, headers, and . * Also used to report parsed header size if parse() is successful */ - int hdr_sz; + int hdr_sz = 0; - int64_t content_length; + int64_t content_length = 0; - HttpMsgParseState pstate; /* the current parsing state */ + /// the current parsing state + HttpMsgParseState pstate = psReadyToParseStartLine; - BodyPipe::Pointer body_pipe; // optional pipeline to receive message body + /// optional pipeline to receive message body + BodyPipe::Pointer body_pipe; - uint32_t sources; ///< The message sources + uint32_t sources = 0; ///< The message sources /// copies Cache-Control header to this message void putCc(const HttpHdrCc *otherCc); @@ -108,7 +111,7 @@ public: void firstLineBuf(MemBuf&); - virtual bool inheritProperties(const HttpMsg *aMsg) = 0; + virtual bool inheritProperties(const Http::Message *) = 0; protected: /** @@ -127,6 +130,8 @@ protected: virtual void hdrCacheInit(); }; +} // namespace Http + #define HTTPMSGUNLOCK(a) if (a) { if ((a)->unlock() == 0) delete (a); (a)=NULL; } #define HTTPMSGLOCK(a) (a)->lock() diff --git a/src/http/StatusLine.cc b/src/http/StatusLine.cc index 74a11aa3ab..892d393bb9 100644 --- a/src/http/StatusLine.cc +++ b/src/http/StatusLine.cc @@ -76,7 +76,7 @@ Http::StatusLine::parse(const String &protoPrefix, const char *start, const char { status_ = Http::scInvalidHeader; /* Squid header parsing error */ - // XXX: HttpMsg::parse() has a similar check but is using + // XXX: Http::Message::parse() has a similar check but is using // casesensitive comparison (which is required by HTTP errata?) if (protoPrefix.cmp("ICY", 3) == 0) { diff --git a/src/http/forward.h b/src/http/forward.h index a322472c7f..7f5e9a643a 100644 --- a/src/http/forward.h +++ b/src/http/forward.h @@ -14,6 +14,9 @@ namespace Http { +class Message; +typedef RefCount MessagePointer; + class Stream; typedef RefCount StreamPointer; diff --git a/src/tests/stub_HttpReply.cc b/src/tests/stub_HttpReply.cc index 202e964df4..39d815607a 100644 --- a/src/tests/stub_HttpReply.cc +++ b/src/tests/stub_HttpReply.cc @@ -12,10 +12,10 @@ #define STUB_API "HttpReply.cc" #include "tests/STUB.h" -HttpReply::HttpReply() : HttpMsg(hoReply), date (0), last_modified (0), +HttpReply::HttpReply() : Http::Message(hoReply), date (0), last_modified (0), expires (0), surrogate_control (NULL), content_range (NULL), keep_alive (0), protoPrefix("HTTP/"), do_clean(false), bodySizeMax(-2) - STUB_NOP + {STUB_NOP} HttpReply::~HttpReply() STUB void HttpReply::setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires_) STUB void HttpReply::packHeadersInto(Packable *) const STUB @@ -27,7 +27,7 @@ HttpReply::HttpReply() : HttpMsg(hoReply), date (0), last_modified (0), bool HttpReply::parseFirstLine(const char *start, const char *end) STUB_RETVAL(false) void HttpReply::hdrCacheInit() STUB HttpReply * HttpReply::clone() const STUB_RETVAL(NULL) - bool HttpReply::inheritProperties(const HttpMsg *aMsg) STUB_RETVAL(false) + bool HttpReply::inheritProperties(const Http::Message *aMsg) STUB_RETVAL(false) bool HttpReply::updateOnNotModified(HttpReply const*) STUB_RETVAL(false) int64_t HttpReply::bodySize(const HttpRequestMethod&) const STUB_RETVAL(0) diff --git a/src/tests/stub_HttpRequest.cc b/src/tests/stub_HttpRequest.cc index 1afc08c247..44ab6cc553 100644 --- a/src/tests/stub_HttpRequest.cc +++ b/src/tests/stub_HttpRequest.cc @@ -15,8 +15,8 @@ // void httpRequestPack(void *obj, Packable *p); -HttpRequest::HttpRequest() : HttpMsg(hoRequest) {STUB} -HttpRequest::HttpRequest(const HttpRequestMethod &, AnyP::ProtocolType, const char *, const char *) : HttpMsg(hoRequest) {STUB} +HttpRequest::HttpRequest() : Http::Message(hoRequest) {STUB} +HttpRequest::HttpRequest(const HttpRequestMethod &, AnyP::ProtocolType, const char *, const char *) : Http::Message(hoRequest) {STUB} HttpRequest::~HttpRequest() STUB void HttpRequest::reset() STUB void HttpRequest::initHTTP(const HttpRequestMethod &, AnyP::ProtocolType, const char *, const char *) STUB @@ -55,6 +55,6 @@ int64_t HttpRequest::getRangeOffsetLimit() STUB_RETVAL(0) void HttpRequest::packFirstLineInto(Packable *, bool) const STUB bool HttpRequest::sanityCheckStartLine(const char *, const size_t, Http::StatusCode *) STUB_RETVAL(false) void HttpRequest::hdrCacheInit() STUB -bool HttpRequest::inheritProperties(const HttpMsg *) STUB_RETVAL(false) +bool HttpRequest::inheritProperties(const Http::Message *) STUB_RETVAL(false) NotePairs::Pointer HttpRequest::notes() STUB_RETVAL(NotePairs::Pointer()) diff --git a/src/tunnel.cc b/src/tunnel.cc index 8822400107..4cbf7e92ef 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -487,7 +487,7 @@ TunnelStateData::handleConnectResponse(const size_t chunkSize) HttpReply rep; Http::StatusCode parseErr = Http::scNone; const bool eof = !chunkSize; - connectRespBuf->terminate(); // HttpMsg::parse requires terminated string + connectRespBuf->terminate(); // Http::Message::parse requires terminated string const bool parsed = rep.parse(connectRespBuf->content(), connectRespBuf->contentSize(), eof, &parseErr); if (!parsed) { if (parseErr > 0) { // unrecoverable parsing error @@ -1170,7 +1170,7 @@ tunnelRelayConnectRequest(const Comm::ConnectionPointer &srv, void *data) tunnelState->connectRespBuf = new MemBuf; // SQUID_TCP_SO_RCVBUF: we should not accumulate more than regular I/O buffer // can hold since any CONNECT response leftovers have to fit into server.buf. - // 2*SQUID_TCP_SO_RCVBUF: HttpMsg::parse() zero-terminates, which uses space. + // 2*SQUID_TCP_SO_RCVBUF: Http::Message::parse() zero-terminates, which uses space. tunnelState->connectRespBuf->init(SQUID_TCP_SO_RCVBUF, 2*SQUID_TCP_SO_RCVBUF); tunnelState->readConnectResponse(); diff --git a/src/whois.cc b/src/whois.cc index 823c695c34..0523573127 100644 --- a/src/whois.cc +++ b/src/whois.cc @@ -105,7 +105,7 @@ WhoisState::setReplyToOK(StoreEntry *sentry) HttpReply *reply = new HttpReply; sentry->buffer(); reply->setHeaders(Http::scOkay, "Gatewaying", "text/plain", -1, -1, -2); - reply->sources |= HttpMsg::srcWhois; + reply->sources |= Http::Message::srcWhois; sentry->replaceHttpReply(reply); }