#ifndef _SQUID_SRC_HTTPPARSER_H
#define _SQUID_SRC_HTTPPARSER_H
+#include "base/RefCount.h"
#include "http/StatusCode.h"
// Parser states
* \item Request Line (method, URL, protocol, version)
* \item Mime header block
*/
-class HttpParser
+class HttpParser : public RefCountable
{
public:
+ typedef RefCount<HttpParser> Pointer;
+
HttpParser() { clear(); }
/** Initialize a new parser.
};
// Legacy functions
-#define HttpParserInit(h,b,l) (h)->reset((b),(l))
int HttpParserParseReqLine(HttpParser *hp);
#define MSGDODEBUG 0
/* Begin the parsing */
PROF_start(parseHttpRequest);
- HttpParserInit(&parser_, in.buf, in.notYetUsed);
+ parser_ = new HttpParser(in.buf, in.notYetUsed);
/* Process request */
Http::ProtocolVersion http_ver;
- ClientSocketContext *context = parseHttpRequest(this, &parser_, &method, &http_ver);
+ ClientSocketContext *context = parseHttpRequest(this, parser_.getRaw(), &method, &http_ver);
PROF_stop(parseHttpRequest);
/* partial or incomplete request */
CommTimeoutCbPtrFun(clientLifetimeTimeout, context->http));
commSetConnTimeout(clientConnection, Config.Timeout.lifetime, timeoutCall);
- clientProcessRequest(this, &parser_, context, method, http_ver);
+ clientProcessRequest(this, parser_.getRaw(), context, method, http_ver);
parsed_req = true; // XXX: do we really need to parse everything right NOW ?