#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)
{
void
HttpReply::hdrCacheInit()
{
- HttpMsg::hdrCacheInit();
+ Http::Message::hdrCacheInit();
http_ver = sline.version;
content_length = header.getInt64(Http::HdrType::CONTENT_LENGTH);
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;
return rep;
}
-bool HttpReply::inheritProperties(const HttpMsg *aMsg)
+bool
+HttpReply::inheritProperties(const Http::Message *aMsg)
{
const HttpReply *aRep = dynamic_cast<const HttpReply*>(aMsg);
if (!aRep)
#include "http/StatusLine.h"
#include "HttpBody.h"
-#include "HttpMsg.h"
#include "HttpRequest.h"
void httpReplyInitModule(void);
class HttpHdrSc;
-class HttpReply: public HttpMsg
+class HttpReply: public Http::Message
{
MEMPROXY_CLASS(HttpReply);
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);
#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);
}
bool
-HttpRequest::inheritProperties(const HttpMsg *aMsg)
+HttpRequest::inheritProperties(const Http::Message *aMsg)
{
const HttpRequest* aReq = dynamic_cast<const HttpRequest*>(aMsg);
if (!aReq)
void
HttpRequest::hdrCacheInit()
{
- HttpMsg::hdrCacheInit();
+ Http::Message::hdrCacheInit();
assert(!range);
range = header.getRange();
#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"
class HttpHdrRange;
-class HttpRequest: public HttpMsg
+class HttpRequest: public Http::Message
{
MEMPROXY_CLASS(HttpRequest);
virtual void hdrCacheInit();
- virtual bool inheritProperties(const HttpMsg *aMsg);
+ virtual bool inheritProperties(const Http::Message *);
};
class ConnStateData;
HttpBody.cc \
HttpControlMsg.cc \
HttpControlMsg.h \
- HttpMsg.cc \
- HttpMsg.h \
HttpReply.cc \
HttpReply.h \
RequestFlags.h \
HttpHeaderTools.cc \
HttpControlMsg.cc \
HttpControlMsg.h \
- HttpMsg.cc \
- HttpMsg.h \
HttpReply.cc \
HttpReply.h \
MasterXaction.cc \
HttpHdrCc.cc \
HttpHdrSc.cc \
HttpHdrScTarget.cc \
- HttpMsg.cc \
int.h \
int.cc \
MasterXaction.cc \
HttpHdrRange.cc \
HttpHdrSc.cc \
HttpHdrScTarget.cc \
- HttpMsg.cc \
HttpReply.cc \
icp_v2.cc \
icp_v3.cc \
HttpHeaderTools.cc \
HttpHeader.h \
HttpHeader.cc \
- HttpMsg.cc \
HttpReply.cc \
int.h \
int.cc \
HttpHdrRange.cc \
HttpHdrSc.cc \
HttpHdrScTarget.cc \
- HttpMsg.cc \
HttpReply.cc \
PeerPoolMgr.h \
PeerPoolMgr.cc \
HttpHdrRange.cc \
HttpHdrSc.cc \
HttpHdrScTarget.cc \
- HttpMsg.cc \
HttpReply.cc \
PeerPoolMgr.h \
PeerPoolMgr.cc \
HttpHeaderFieldInfo.h \
HttpHeaderTools.h \
HttpHeaderTools.cc \
- HttpMsg.cc \
HttpReply.cc \
PeerPoolMgr.h \
PeerPoolMgr.cc \
HttpHdrRange.cc \
HttpHdrSc.cc \
HttpHdrScTarget.cc \
- HttpMsg.cc \
HttpReply.cc \
icp_v2.cc \
icp_v3.cc \
HttpHeaderTools.cc \
HttpHeader.h \
HttpHeader.cc \
- HttpMsg.cc \
RequestFlags.cc \
RequestFlags.h \
int.h \
tests/stub_CacheDigest.cc \
ConfigParser.cc \
EventLoop.cc \
- HttpMsg.cc \
RemovalPolicy.cc \
repl_modules.h \
store.cc \
HttpHeaderFieldInfo.h \
HttpHeaderTools.h \
HttpHeaderTools.cc \
- HttpMsg.cc \
HttpReply.cc \
int.h \
int.cc \
HttpHeaderFieldInfo.h \
HttpHeaderTools.h \
HttpHeaderTools.cc \
- HttpMsg.cc \
HttpReply.cc \
PeerPoolMgr.h \
PeerPoolMgr.cc \
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;
}
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;
}
#include "squid.h"
#include "adaptation/Answer.h"
#include "base/AsyncJobCalls.h"
+#include "http/Message.h"
Adaptation::Answer
Adaptation::Answer::Error(bool final)
}
Adaptation::Answer
-Adaptation::Answer::Forward(HttpMsg *aMsg)
+Adaptation::Answer::Forward(Http::Message *aMsg)
{
Answer answer(akForward);
answer.message = aMsg;
#define SQUID_ADAPTATION__ANSWER_H
#include "adaptation/forward.h"
-#include "HttpMsg.h"
+#include "http/forward.h"
+#include "SquidString.h"
#include <iosfwd>
} 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
#include "adaptation/Initiate.h"
#include "adaptation/Initiator.h"
#include "base/AsyncJobCalls.h"
-#include "HttpMsg.h"
+#include "http/Message.h"
namespace Adaptation
{
#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"),
{
switch (answer.kind) {
case Answer::akForward:
- handleAdaptedHeader(const_cast<HttpMsg*>(answer.message.getRaw()));
+ handleAdaptedHeader(const_cast<Http::Message*>(answer.message.getRaw()));
break;
case Answer::akBlock:
}
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
#include "adaptation/Initiate.h"
#include "adaptation/Initiator.h"
#include "adaptation/ServiceGroups.h"
-
-class HttpMsg;
-class HttpRequest;
+#include "http/forward.h"
namespace Adaptation
{
CBDATA_CLASS(Iterator);
public:
- Iterator(HttpMsg *virginHeader, HttpRequest *virginCause,
+ Iterator(Http::Message *virginHeader, HttpRequest *virginCause,
AccessLogEntry::Pointer &alp,
const Adaptation::ServiceGroupPointer &aGroup);
virtual ~Iterator();
/// 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<Adaptation::Initiate> theLauncher; ///< current transaction launcher
#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)
{
#define SQUID__ADAPTATION__MESSAGE_H
#include "base/RefCount.h"
+#include "http/forward.h"
-class HttpMsg;
class BodyPipe;
typedef RefCount<BodyPipe> BodyPipePointer;
// 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);
#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
{
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;
/* HeaderRep */
-Adaptation::Ecap::HeaderRep::HeaderRep(HttpMsg &aMessage): theHeader(aMessage.header),
+Adaptation::Ecap::HeaderRep::HeaderRep(Http::Message &aMessage): theHeader(aMessage.header),
theMessage(aMessage)
{
}
/* FirstLineRep */
-Adaptation::Ecap::FirstLineRep::FirstLineRep(HttpMsg &aMessage): theMessage(aMessage)
+Adaptation::Ecap::FirstLineRep::FirstLineRep(Http::Message &aMessage): theMessage(aMessage)
{
}
/* MessageRep */
-Adaptation::Ecap::MessageRep::MessageRep(HttpMsg *rawHeader):
+Adaptation::Ecap::MessageRep::MessageRep(Http::Message *rawHeader):
theMessage(rawHeader), theFirstLineRep(NULL),
theHeaderRep(NULL), theBodyRep(NULL)
{
libecap::shared_ptr<libecap::Message>
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<libecap::Message> res(new MessageRep(hdr));
#include "adaptation/Message.h"
#include "anyp/ProtocolType.h"
#include "BodyPipe.h"
+#include "http/forward.h"
#include "HttpHeader.h"
+
#include <libecap/common/message.h>
#include <libecap/common/header.h>
#include <libecap/common/body.h>
-class HttpMsg;
-class HttpRequest;
-class HttpReply;
-
namespace Adaptation
{
namespace Ecap
class XactionRep;
-// Translates Squid HttpMsg into libecap::Header.
+// Translates Squid Http::Message into libecap::Header.
class HeaderRep: public libecap::Header
{
public:
typedef libecap::Area Area;
public:
- HeaderRep(HttpMsg &aMessage);
+ HeaderRep(Http::Message &aMessage);
/* libecap::Header API */
virtual bool hasAny(const Name &name) const;
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);
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.
class MessageRep: public libecap::Message
{
public:
- explicit MessageRep(HttpMsg *rawHeader);
+ explicit MessageRep(Http::Message *rawHeader);
virtual ~MessageRep();
/* libecap::Message API */
}
Adaptation::Initiate *
-Adaptation::Ecap::ServiceRep::makeXactLauncher(HttpMsg *virgin,
+Adaptation::Ecap::ServiceRep::makeXactLauncher(Http::Message *virgin,
HttpRequest *cause, AccessLogEntry::Pointer &alp)
{
Must(up());
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;
};
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"),
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);
theAnswerRep = m;
Must(proxyingAb == opUndecided);
- HttpMsg *msg = answer().header;
+ Http::Message *msg = answer().header;
updateSources(msg);
if (!theAnswerRep->body()) { // final, bodyless answer
proxyingAb = opNever;
/// 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;
}
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;
}
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<libecap::adapter::Xaction> AdapterXaction;
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;
#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
{
public:
- typedef HttpMsg Header;
+ // TODO: s/Header/Message/i ?
+ typedef Http::Message Header;
InOut(): header(0), cause(0) {}
BodyPipe::Pointer body_pipe;
};
-// TODO: s/Header/Message/i ?
-
} // namespace Icap
} // namespace Adaptation
#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):
#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"
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),
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.
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;
// allocate the adapted message and copy metainfo
Must(!adapted.header);
{
- HttpMsg::Pointer newHead;
+ Http::MessagePointer newHead;
if (dynamic_cast<const HttpRequest*>(oldHead)) {
newHead = new HttpRequest;
} else if (dynamic_cast<const HttpReply*>(oldHead)) {
// 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
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);
}
// 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();
#endif
al.cache.code = h->logType;
- const HttpMsg *virgin_msg = dynamic_cast<HttpReply*>(virgin.header);
+ const Http::Message *virgin_msg = dynamic_cast<HttpReply*>(virgin.header);
if (!virgin_msg)
virgin_msg = virgin_request_;
assert(virgin_msg != virgin.cause);
}
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())
#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<const HttpRequest*>(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;
// 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);
}
{
// note: lack of size info may disable previews and 204s
- HttpMsg *msg = virgin.header;
+ Http::Message *msg = virgin.header;
Must(msg);
HttpRequestMethod method;
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)
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
void parseHeaders();
void parseIcapHead();
void parseHttpHead();
- bool parseHead(HttpMsg *head);
+ bool parseHead(Http::Message *head);
void decideOnParsingBody();
void parseBody();
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();
template<class Part>
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;
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();
// 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);
}
}
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());
}
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);
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);
#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"
}
}
-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");
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;
#include "format/Format.h"
#include "helper.h"
#include "helper/Reply.h"
-#include "HttpMsg.h"
#include "HttpRequest.h"
#include "MemBuf.h"
#include "rfc1738.h"
#include "helper.h"
#include "helper/Reply.h"
#include "http/Stream.h"
-#include "HttpMsg.h"
#include "HttpRequest.h"
#include "MemBuf.h"
#include "SquidTime.h"
// 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)
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);
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();
switch (answer.kind) {
case Adaptation::Answer::akForward:
- handleAdaptedHeader(const_cast<HttpMsg*>(answer.message.getRaw()));
+ handleAdaptedHeader(const_cast<Http::Message*>(answer.message.getRaw()));
break;
case Adaptation::Answer::akBlock:
}
void
-ClientHttpRequest::handleAdaptedHeader(HttpMsg *msg)
+ClientHttpRequest::handleAdaptedHeader(Http::Message *msg)
{
assert(msg);
#include "acl/forward.h"
#include "client_side.h"
#include "clientStream.h"
+#include "http/forward.h"
#include "HttpHeaderRange.h"
#include "LogTags.h"
#include "Store.h"
#if USE_ADAPTATION
#include "adaptation/forward.h"
#include "adaptation/Initiator.h"
-class HttpMsg;
#endif
class ClientRequestContext;
// 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);
// 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;
switch (answer.kind) {
case Adaptation::Answer::akForward:
- handleAdaptedHeader(const_cast<HttpMsg*>(answer.message.getRaw()));
+ handleAdaptedHeader(const_cast<Http::Message*>(answer.message.getRaw()));
break;
case Adaptation::Answer::akBlock:
}
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
#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
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);
#include "HttpHeader.h"
#include "HttpHeaderRange.h"
#include "HttpReply.h"
-#include "HttpRequest.h"
#include "ip/tools.h"
#include "MemBuf.h"
#include "mime.h"
if (mime_enc)
reply->header.putStr(Http::HdrType::CONTENT_ENCODING, mime_enc);
- reply->sources |= HttpMsg::srcFtp;
+ reply->sources |= Http::Message::srcFtp;
setVirginReply(reply);
adaptOrFinalizeReply();
}
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();
" (" << 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);
/// \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)
/// 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
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();
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();
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();
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();
#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
#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;
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.
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;
// 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();
ContentLengthInterpreter.cc \
ContentLengthInterpreter.h \
forward.h \
+ Message.cc \
+ Message.h \
MethodType.cc \
MethodType.h \
ProtocolVersion.h \
#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) {
// 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;
}
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;
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
}
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;
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;
}
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
/* 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);
}
bool
-HttpMsg::persistent() const
+Http::Message::persistent() const
{
if (http_ver > Http::ProtocolVersion(1,0)) {
/*
}
}
-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);
}
* 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"
#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<HttpMsg> Pointer;
/// Who may have created or modified this message?
enum Sources {
srcUnknown = 0,
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.
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 <CRLF>.
* 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);
void firstLineBuf(MemBuf&);
- virtual bool inheritProperties(const HttpMsg *aMsg) = 0;
+ virtual bool inheritProperties(const Http::Message *) = 0;
protected:
/**
virtual void hdrCacheInit();
};
+} // namespace Http
+
#define HTTPMSGUNLOCK(a) if (a) { if ((a)->unlock() == 0) delete (a); (a)=NULL; }
#define HTTPMSGLOCK(a) (a)->lock()
{
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) {
namespace Http
{
+class Message;
+typedef RefCount<Http::Message> MessagePointer;
+
class Stream;
typedef RefCount<Http::Stream> StreamPointer;
#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
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)
// 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
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())
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
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();
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);
}