Bug #226 - Adding support for unknown methods.
Response for these methods will not be cached.
All cache entries for this url will be invalidated.
see bugzilla entry #226 for further details.
/*
- * $Id: ACLMethod.cc,v 1.3 2003/10/20 12:33:01 robertc Exp $
+ * $Id: ACLMethod.cc,v 1.4 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
/* explicit template instantiation required for some systems */
-template class ACLStrategised<method_t>
+template class ACLStrategised<HttpRequestMethod>
;
ACL::Prototype ACLMethod::RegistryProtoype(&ACLMethod::RegistryEntry_, "method");
-ACLStrategised<method_t> ACLMethod::RegistryEntry_(new ACLMethodData, ACLMethodStrategy::Instance(), "method");
+ACLStrategised<HttpRequestMethod> ACLMethod::RegistryEntry_(new ACLMethodData, ACLMethodStrategy::Instance(), "method");
int
ACLMethodStrategy::match (ACLData<MatchType> * &data, ACLChecklist *checklist)
/*
- * $Id: ACLMethod.h,v 1.1 2003/02/25 12:22:33 robertc Exp $
+ * $Id: ACLMethod.h,v 1.2 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLStrategy.h"
#include "ACLStrategised.h"
-class ACLMethodStrategy : public ACLStrategy<method_t>
+class ACLMethodStrategy : public ACLStrategy<HttpRequestMethod>
{
public:
private:
static ACL::Prototype RegistryProtoype;
- static ACLStrategised<method_t> RegistryEntry_;
+ static ACLStrategised<HttpRequestMethod> RegistryEntry_;
};
#endif /* SQUID_ACLMETHOD_H */
/*
- * $Id: ACLMethodData.cc,v 1.9 2006/05/08 23:38:33 robertc Exp $
+ * $Id: ACLMethodData.cc,v 1.10 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
}
bool
-ACLMethodData::match(method_t toFind)
+ACLMethodData::match(HttpRequestMethod toFind)
{
return values->findAndTune (toFind);
}
/* explicit instantiation required for some systems */
-template cbdata_type List<method_t>
+template cbdata_type List<HttpRequestMethod>
::CBDATA_List;
wordlist *
ACLMethodData::dump()
{
wordlist *W = NULL;
- List<method_t> *data = values;
+ List<HttpRequestMethod> *data = values;
while (data != NULL) {
- wordlistAdd(&W, RequestMethodStr[data->element]);
+ wordlistAdd(&W, RequestMethodStr(data->element));
data = data->next;
}
void
ACLMethodData::parse()
{
- List<method_t> **Tail;
+ List<HttpRequestMethod> **Tail;
char *t = NULL;
for (Tail = &values; *Tail; Tail = &((*Tail)->next))
;
while ((t = strtokFile())) {
- List<method_t> *q = new List<method_t> (HttpRequestMethod(t));
+ List<HttpRequestMethod> *q = new List<HttpRequestMethod> (HttpRequestMethod(t));
*(Tail) = q;
Tail = &q->next;
}
return values == NULL;
}
-ACLData<method_t> *
+ACLData<HttpRequestMethod> *
ACLMethodData::clone() const
{
assert (!values);
/*
- * $Id: ACLMethodData.h,v 1.4 2005/05/08 06:36:45 hno Exp $
+ * $Id: ACLMethodData.h,v 1.5 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLData.h"
#include "List.h"
-class ACLMethodData : public ACLData<method_t>
+class ACLMethodData : public ACLData<HttpRequestMethod>
{
public:
ACLMethodData(ACLMethodData const &);
ACLMethodData &operator= (ACLMethodData const &);
virtual ~ACLMethodData();
- bool match(method_t);
+ bool match(HttpRequestMethod);
wordlist *dump();
void parse();
bool empty() const;
- virtual ACLData<method_t> *clone() const;
+ virtual ACLData<HttpRequestMethod> *clone() const;
- List<method_t> *values;
+ List<HttpRequestMethod> *values;
};
MEMPROXY_CLASS_INLINE(ACLMethodData)
/*
- * $Id: AccessLogEntry.h,v 1.7 2007/12/14 23:11:45 amosjeffries Exp $
+ * $Id: AccessLogEntry.h,v 1.8 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
public:
HttpDetails() : method(METHOD_NONE), code(0), content_type(NULL) {}
- method_t method;
+ HttpRequestMethod method;
int code;
const char *content_type;
HttpVersion version;
/*
- * $Id: HttpMsg.h,v 1.16 2007/08/13 17:20:51 hno Exp $
+ * $Id: HttpMsg.h,v 1.17 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
virtual int httpMsgParseError();
- virtual bool expectingBody(method_t, int64_t&) const = 0;
+ virtual bool expectingBody(const HttpRequestMethod&, int64_t&) const = 0;
void firstLineBuf(MemBuf&);
/*
- * $Id: HttpReply.cc,v 1.97 2007/11/26 13:09:55 hno Exp $
+ * $Id: HttpReply.cc,v 1.98 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 58 HTTP Reply (Response)
* AUTHOR: Alex Rousskov
* Returns the body size of a HTTP response
*/
int64_t
-HttpReply::bodySize(method_t method) const
+HttpReply::bodySize(const HttpRequestMethod& method) const
{
if (sline.version.major < 1)
return -1;
* along with this response
*/
bool
-HttpReply::expectingBody(method_t req_method, int64_t& theSize) const
+HttpReply::expectingBody(const HttpRequestMethod& req_method, int64_t& theSize) const
{
bool expectBody = true;
/*
- * $Id: HttpReply.h,v 1.21 2007/08/13 17:20:51 hno Exp $
+ * $Id: HttpReply.h,v 1.22 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
public:
virtual int httpMsgParseError();
- virtual bool expectingBody(method_t, int64_t&) const;
+ virtual bool expectingBody(const HttpRequestMethod&, int64_t&) const;
void updateOnNotModified(HttpReply const *other);
void redirect(http_status, const char *);
- int64_t bodySize(method_t) const;
+ int64_t bodySize(const HttpRequestMethod&) const;
int validatorsMatch (HttpReply const *other) const;
/*
- * $Id: HttpRequest.cc,v 1.78 2007/12/14 23:11:45 amosjeffries Exp $
+ * $Id: HttpRequest.cc,v 1.79 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
init();
}
-HttpRequest::HttpRequest(method_t aMethod, protocol_t aProtocol, const char *aUrlpath) : HttpMsg(hoRequest)
+HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath) : HttpMsg(hoRequest)
{
init();
initHTTP(aMethod, aProtocol, aUrlpath);
}
void
-HttpRequest::initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath)
+HttpRequest::initHTTP(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath)
{
method = aMethod;
protocol = aProtocol;
assert(p);
/* pack request-line */
packerPrintf(p, "%s %s HTTP/1.0\r\n",
- RequestMethodStr[method], urlpath.buf());
+ RequestMethodStr(method), urlpath.buf());
/* headers */
header.packInto(p);
/* trailer */
int
HttpRequest::prefixLen()
{
- return strlen(RequestMethodStr[method]) + 1 +
+ return strlen(RequestMethodStr(method)) + 1 +
urlpath.size() + 1 +
4 + 1 + 3 + 2 +
header.len + 2;
{
// form HTTP request-line
packerPrintf(p, "%s %s HTTP/%d.%d\r\n",
- RequestMethodStr[method],
+ RequestMethodStr(method),
packableURI(full_uri),
http_ver.major, http_ver.minor);
}
* along with this request
*/
bool
-HttpRequest::expectingBody(method_t unused, int64_t& theSize) const
+HttpRequest::expectingBody(const HttpRequestMethod& unused, int64_t& theSize) const
{
bool expectBody = false;
* If the request cannot be created cleanly, NULL is returned
*/
HttpRequest *
-HttpRequest::CreateFromUrlAndMethod(char * url, method_t method)
+HttpRequest::CreateFromUrlAndMethod(char * url, const HttpRequestMethod& method)
{
return urlParse(method, url, NULL);
}
* The below looks questionable: what non HTTP protocols use connect,
* trace, put and post? RC
*/
- if (method == METHOD_CONNECT)
- return 0;
-
- if (method == METHOD_TRACE)
- return 0;
-
- if (method == METHOD_PUT)
- return 0;
-
- if (method == METHOD_POST)
- return 0;
+
+ if (!method.isCacheble())
+ return false;
/*
* XXX POST may be cached sometimes.. ignored
return gopherCachable(this);
if (protocol == PROTO_CACHEOBJ)
- return 0;
+ return false;
- return 1;
+ return true;
}
/*
- * $Id: HttpRequest.h,v 1.31 2007/12/14 23:11:45 amosjeffries Exp $
+ * $Id: HttpRequest.h,v 1.32 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
public:
MEMPROXY_CLASS(HttpRequest);
HttpRequest();
- HttpRequest(method_t aMethod, protocol_t aProtocol, const char *aUrlpath);
+ HttpRequest(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath);
~HttpRequest();
virtual void reset();
return static_cast<HttpRequest*>(HttpMsg::_lock());
};
- void initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath);
+ void initHTTP(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath);
/* are responses to this request potentially cachable */
bool cacheable() const;
void init();
public:
- method_t method;
+ HttpRequestMethod method;
char login[MAX_LOGIN_SZ];
int parseHeader(const char *parse_start, int len);
- virtual bool expectingBody(method_t unused, int64_t&) const;
+ virtual bool expectingBody(const HttpRequestMethod& unused, int64_t&) const;
bool bodyNibbled() const; // the request has a [partially] consumed body
static void httpRequestPack(void *obj, Packer *p);
- static HttpRequest * CreateFromUrlAndMethod(char * url, method_t method);
+ static HttpRequest * CreateFromUrlAndMethod(char * url, const HttpRequestMethod& method);
static HttpRequest * CreateFromUrl(char * url);
/*
- * $Id: HttpRequestMethod.cc,v 1.4 2007/04/30 16:56:09 wessels Exp $
+ * $Id: HttpRequestMethod.cc,v 1.5 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
#include "HttpRequestMethod.h"
#include "wordlist.h"
-const char *RequestMethodStr[] =
+const char* HttpRequestMethod::RequestMethodStr[] =
{
"NONE",
"GET",
};
static
-method_t &operator++ (method_t &aMethod)
+_method_t &operator++ (_method_t &aMethod)
{
int tmp = (int)aMethod;
- aMethod = (method_t)(++tmp);
+ aMethod = (_method_t)(++tmp);
return aMethod;
}
*/
if (NULL == end)
end = begin + strcspn(begin, w_space);
-
+
+ if (end == begin) {
+ theMethod = METHOD_NONE;
+ return;
+ }
+
for (++theMethod; theMethod < METHOD_ENUM_END; ++theMethod) {
- if (0 == strncasecmp(begin, RequestMethodStr[theMethod], end-begin))
+ if (0 == strncasecmp(begin, RequestMethodStr[theMethod], end-begin)) {
return;
+ }
}
- /* reset to none */
- theMethod = METHOD_NONE;
+ // if method not found and method string is not null then it is other method
+ theMethod = METHOD_OTHER;
+ theImage.limitInit(begin,end-begin);
}
void
HttpRequestMethod::AddExtension(const char *mstr)
{
- method_t method = METHOD_NONE;
+ _method_t method = METHOD_NONE;
for (++method; method < METHOD_ENUM_END; ++method) {
if (0 == strcmp(mstr, RequestMethodStr[method])) {
w = w->next;
}
}
+
+char const*
+HttpRequestMethod::image() const
+{
+ if (METHOD_OTHER != theMethod) {
+ return RequestMethodStr[theMethod];
+ }
+ else {
+ if (theImage.size()>0)
+ return theImage.buf();
+ else
+ return "METHOD_OTHER";
+ }
+}
+
+bool
+HttpRequestMethod::isCacheble() const
+{
+ if (theMethod == METHOD_CONNECT)
+ return false;
+
+ if (theMethod == METHOD_TRACE)
+ return false;
+
+ if (theMethod == METHOD_PUT)
+ return false;
+
+ if (theMethod == METHOD_POST)
+ return false;
+
+ if (theMethod == METHOD_OTHER)
+ return false;
+
+ return true;
+}
/*
- * $Id: HttpRequestMethod.h,v 1.5 2007/11/13 23:09:23 rousskov Exp $
+ * $Id: HttpRequestMethod.h,v 1.6 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
METHOD_EXT17,
METHOD_EXT18,
METHOD_EXT19,
- METHOD_ENUM_END
+ METHOD_OTHER,
+ METHOD_ENUM_END // MUST be last, (yuck) this is used as an array-initialization index constant!
};
-typedef enum _method_t method_t;
-
-extern const char *RequestMethodStr[];
-
/* forward decls */
typedef struct _SquidConfig SquidConfig;
HttpRequestMethod() : theMethod(METHOD_NONE) {}
- HttpRequestMethod(method_t const aMethod) : theMethod(aMethod) {}
+ HttpRequestMethod(_method_t const aMethod) : theMethod(aMethod) {}
HttpRequestMethod(char const * begin, char const * end=0);
- operator method_t() const {return theMethod; }
+ operator _method_t() const {return theMethod; }
+
+ HttpRequestMethod & operator = (const HttpRequestMethod& aMethod)
+ {
+ theMethod = aMethod.theMethod;
+ theImage = aMethod.theImage;
+ return *this;
+ }
- HttpRequestMethod & operator = (method_t const aMethod)
+ HttpRequestMethod & operator = (_method_t const aMethod)
{
theMethod = aMethod;
+ theImage.clean();
return *this;
}
- bool operator != (method_t const & aMethod) { return theMethod != aMethod;}
+ bool operator != (_method_t const & aMethod) { return theMethod != aMethod;}
+ bool operator != (HttpRequestMethod const & aMethod)
+ {
+ return ( (theMethod != aMethod) || (theImage != aMethod.theImage) );
+ }
+
+ HttpRequestMethod& operator++()
+ {
+ if (METHOD_OTHER!=theMethod)
+ {
+ int tmp = (int)theMethod;
+ _method_t tmp_m = (_method_t)(++tmp);
+
+ if (METHOD_ENUM_END >= tmp_m)
+ theMethod = tmp_m;
+ }
+ return *this;
+ }
+
/* Get a char string representation of the method. */
- char const *const_str() const { return RequestMethodStr[theMethod]; }
+ char const* image() const;
+
+ bool isCacheble() const;
private:
- method_t theMethod;
-
+ static const char *RequestMethodStr[];
+
+ _method_t theMethod; ///< Method type
+ String theImage; ///< Used for store METHOD_OTHER only
};
+
inline std::ostream &
operator << (std::ostream &os, HttpRequestMethod const &method)
{
- os << method.const_str();
+ os << method.image();
return os;
}
+inline const char*
+RequestMethodStr(const _method_t m)
+{
+ return HttpRequestMethod(m).image();
+}
+
+inline const char*
+RequestMethodStr(const HttpRequestMethod& m)
+{
+ return m.image();
+}
+
#endif /* SQUID_HTTPREQUESTMETHOD_H */
HttpMsg *msg = virgin.header;
Must(msg);
- method_t method;
+ HttpRequestMethod method;
if (virgin.cause)
method = virgin.cause->method;
/*
- * $Id: MemObject.cc,v 1.32 2007/11/15 16:47:35 wessels Exp $
+ * $Id: MemObject.cc,v 1.33 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 19 Store Memory Primitives
* AUTHOR: Robert Collins
MemObject::stat (MemBuf * mb) const
{
mb->Printf("\t%s %s\n",
- RequestMethodStr[method], log_url);
+ RequestMethodStr(method), log_url);
mb->Printf("\tinmem_lo: %"PRId64"\n", inmem_lo);
mb->Printf("\tinmem_hi: %"PRId64"\n", data_hdr.endOffset());
mb->Printf("\tswapout: %"PRId64" bytes queued\n",
/*
- * $Id: MemObject.h,v 1.15 2007/08/13 17:20:51 hno Exp $
+ * $Id: MemObject.h,v 1.16 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
void checkUrlChecksum() const;
#endif
- method_t method;
+ HttpRequestMethod method;
char *url;
mem_hdr data_hdr;
int64_t inmem_lo;
/*
- * $Id: SquidString.h,v 1.13 2008/01/19 10:38:32 amosjeffries Exp $
+ * $Id: SquidString.h,v 1.14 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 67 String
* AUTHOR: Duane Wessels
#ifndef SQUID_STRING_H
#define SQUID_STRING_H
+
/* forward decls */
class CacheManager;
/*
- * $Id: Store.h,v 1.41 2008/01/07 17:12:28 hno Exp $
+ * $Id: Store.h,v 1.42 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
public:
static size_t inUseCount();
- static void getPublicByRequestMethod(StoreClient * aClient, HttpRequest * request, const method_t method);
+ static void getPublicByRequestMethod(StoreClient * aClient, HttpRequest * request, const HttpRequestMethod& method);
static void getPublicByRequest(StoreClient * aClient, HttpRequest * request);
- static void getPublic(StoreClient * aClient, const char *uri, const method_t method);
+ static void getPublic(StoreClient * aClient, const char *uri, const HttpRequestMethod& method);
virtual bool isNull()
{
SQUIDCEXTERN const char *storeEntryFlags(const StoreEntry *);
extern void storeEntryReplaceObject(StoreEntry *, HttpReply *);
-SQUIDCEXTERN StoreEntry *storeGetPublic(const char *uri, const method_t method);
+SQUIDCEXTERN StoreEntry *storeGetPublic(const char *uri, const HttpRequestMethod& method);
SQUIDCEXTERN StoreEntry *storeGetPublicByRequest(HttpRequest * request);
-SQUIDCEXTERN StoreEntry *storeGetPublicByRequestMethod(HttpRequest * request, const method_t method);
-SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_flags, method_t);
+SQUIDCEXTERN StoreEntry *storeGetPublicByRequestMethod(HttpRequest * request, const HttpRequestMethod& method);
+SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_flags, const HttpRequestMethod&);
SQUIDCEXTERN void storeInit(void);
extern void storeRegisterWithCacheManager(CacheManager & manager);
SQUIDCEXTERN void storeConfigure(void);
/*
- * $Id: access_log.cc,v 1.129 2007/12/14 23:11:45 amosjeffries Exp $
+ * $Id: access_log.cc,v 1.130 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
if (al->icp.opcode)
al->_private.method_str = icp_opcode_str[al->icp.opcode];
else
- al->_private.method_str = RequestMethodStr[al->http.method];
+ al->_private.method_str = RequestMethodStr(al->http.method);
if (al->hier.host[0] == '\0')
xstrncpy(al->hier.host, dash_str, SQUIDHOSTNAMELEN);
#if HEADERS_LOG
void
-headersLog(int cs, int pq, method_t method, void *data)
+headersLog(int cs, int pq, const HttpRequestMethod& method, void *data)
{
HttpReply *rep;
HttpRequest *req;
/*
- * $Id: acl.cc,v 1.324 2007/12/05 16:02:29 rousskov Exp $
+ * $Id: acl.cc,v 1.325 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
for (; a; a = a->next) {
for (b = a->aclList; b; b = b->next) {
- ACLStrategised<method_t> *tempAcl = dynamic_cast<ACLStrategised<method_t> *>(b->_acl);
+ ACLStrategised<HttpRequestMethod> *tempAcl = dynamic_cast<ACLStrategised<HttpRequestMethod> *>(b->_acl);
if (!tempAcl) {
debugs(28, 7, "acl_access::containsPURGE: can't create tempAcl");
/*
- * $Id: auth_digest.cc,v 1.61 2007/12/30 04:06:30 hno Exp $
+ * $Id: auth_digest.cc,v 1.62 2008/01/20 08:54:30 amosjeffries Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
digest_user->HA1, SESSIONKEY);
DigestCalcResponse(SESSIONKEY, authenticateDigestNonceNonceb64(digest_request->nonce),
digest_request->nc, digest_request->cnonce, digest_request->qop,
- RequestMethodStr[request->method], digest_request->uri, HA2, Response);
+ RequestMethodStr(request->method), digest_request->uri, HA2, Response);
debugs(29, 9, "\nResponse = '" << digest_request->response << "'\nsquid is = '" << Response << "'");
*/
DigestCalcResponse(SESSIONKEY, authenticateDigestNonceNonceb64(digest_request->nonce),
digest_request->nc, digest_request->cnonce, digest_request->qop,
- RequestMethodStr[METHOD_GET], digest_request->uri, HA2, Response);
+ RequestMethodStr(METHOD_GET), digest_request->uri, HA2, Response);
if (strcasecmp(digest_request->response, Response)) {
credentials(Failed);
/*
- * $Id: client_side.cc,v 1.771 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: client_side.cc,v 1.772 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
static PF clientLifetimeTimeout;
static ClientSocketContext *parseHttpRequestAbort(ConnStateData::Pointer & conn,
const char *uri);
-static ClientSocketContext *parseHttpRequest(ConnStateData::Pointer &, HttpParser *, method_t *, HttpVersion *);
+static ClientSocketContext *parseHttpRequest(ConnStateData::Pointer &, HttpParser *, HttpRequestMethod *, HttpVersion *);
#if USE_IDENT
static IDCB clientIdentDone;
#endif
debugs(33, 3, "clientSetKeepaliveFlag: http_ver = " <<
request->http_ver.major << "." << request->http_ver.minor);
debugs(33, 3, "clientSetKeepaliveFlag: method = " <<
- RequestMethodStr[request->method]);
+ RequestMethodStr(request->method));
HttpVersion http_ver(1,0);
/* we are HTTP/1.0, no matter what the client requests... */
* Sets result->flags.parsed_ok to 1 if we have a good request.
*/
static ClientSocketContext *
-parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * method_p, HttpVersion *http_ver)
+parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, HttpRequestMethod * method_p, HttpVersion *http_ver)
{
char *url = NULL;
char *req_hdr = NULL;
}
/* Set method_p */
- *method_p = HttpRequestMethod(&hp->buf[hp->m_start], &hp->buf[hp->m_end]);
+ *method_p = HttpRequestMethod(&hp->buf[hp->m_start], &hp->buf[hp->m_end]+1);
if (*method_p == METHOD_NONE) {
/* XXX need a way to say "this many character length string" */
}
static void
-clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketContext *context, method_t method, HttpVersion http_ver)
+clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketContext *context, const HttpRequestMethod& method, HttpVersion http_ver)
{
ClientHttpRequest *http = context->http;
HttpRequest *request = NULL;
static bool
clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
{
- method_t method;
+ HttpRequestMethod method;
ClientSocketContext *context;
bool parsed_req = false;
HttpVersion http_ver;
/*
- * $Id: client_side_reply.cc,v 1.147 2007/12/26 22:19:37 hno Exp $
+ * $Id: client_side_reply.cc,v 1.148 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
*/
void
clientReplyContext::setReplyToError(
- err_type err, http_status status, method_t method, char const *uri,
+ err_type err, http_status status, const HttpRequestMethod& method, char const *uri,
IPAddress &addr, HttpRequest * failedrequest, char *unparsedrequest,
AuthUserRequest * auth_user_request)
{
char *url = http->uri;
HttpRequest *r = http->request;
ErrorState *err = NULL;
- debugs(88, 4, "clientProcessMiss: '" << RequestMethodStr[r->method] << " " << url << "'");
+ debugs(88, 4, "clientProcessMiss: '" << RequestMethodStr(r->method) << " " << url << "'");
/*
* We might have a left-over StoreEntry from a failed cache hit
* or IMS request.
purgeRequest();
return;
}
+
+ if (METHOD_OTHER == r->method) {
+ // invalidate all cache entries
+ purgeAllCached();
+ }
if (http->onlyIfCached()) {
processOnlyIfCachedMiss();
triggerInitialStoreRead();
return;
} else {
- assert(http->out.offset == 0);
+ assert(http->out.offset == 0);
createStoreEntry(r->method, r->flags);
triggerInitialStoreRead();
{
ErrorState *err = NULL;
debugs(88, 4, "clientProcessOnlyIfCachedMiss: '" <<
- RequestMethodStr[http->request->method] << " " << http->uri << "'");
+ RequestMethodStr(http->request->method) << " " << http->uri << "'");
http->al.http.code = HTTP_GATEWAY_TIMEOUT;
err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL, http->getConn()->peer, http->request);
removeClientStoreReference(&sc, http);
void
clientReplyContext::purgeRequestFindObjectToPurge()
-{
+{
/* Try to find a base entry */
http->flags.purging = 1;
lookingforstore = 1;
+
+ // TODO: can we use purgeAllCached() here instead of doing the
+ // getPublicByRequestMethod() dance?
StoreEntry::getPublicByRequestMethod(this, http->request, METHOD_GET);
}
+/*
+ * We probably cannot purge Vary-affected responses because their MD5
+ * keys depend on vary headers.
+ */
+void
+clientReplyContext::purgeAllCached()
+{
+ const char *url = urlCanonical(http->request);
+
+ HttpRequestMethod m(METHOD_NONE);
+ for (; m!=METHOD_ENUM_END; ++m) {
+ if (m.isCacheble()) {
+ if (StoreEntry *entry = storeGetPublic(url, m)) {
+ debugs(88, 5, "purging " << RequestMethodStr(m) << ' ' << url);
+ entry->release();
+ }
+ } // end if(isCacheble())
+ } // end for
+
+} // purgeAllCached
+
void
clientReplyContext::created(StoreEntry *newEntry)
{
void
clientReplyContext::processReplyAccessResult(bool accessAllowed)
{
- debugs(88, 2, "The reply for " << RequestMethodStr[http->request->method]
+ debugs(88, 2, "The reply for " << RequestMethodStr(http->request->method)
<< " " << http->uri << " is "
<< ( accessAllowed ? "ALLOWED" : "DENIED")
<< ", because it matched '"
/* Using this breaks the client layering just a little!
*/
void
-clientReplyContext::createStoreEntry(method_t m, request_flags flags)
+clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags flags)
{
assert(http != NULL);
/*
/*
- * $Id: client_side_reply.h,v 1.19 2008/01/07 17:12:28 hno Exp $
+ * $Id: client_side_reply.h,v 1.20 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
int storeOKTransferDone() const;
int storeNotOKTransferDone() const;
- void setReplyToError(err_type, http_status, method_t, char const *, IPAddress &, HttpRequest *, char *, AuthUserRequest *);
- void createStoreEntry(method_t m, request_flags flags);
+ void setReplyToError(err_type, http_status, const HttpRequestMethod&, char const *, IPAddress &, HttpRequest *, char *, AuthUserRequest *);
+ void createStoreEntry(const HttpRequestMethod& m, request_flags flags);
void removeStoreReference(store_client ** scp, StoreEntry ** ep);
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http);
void startError(ErrorState * err);
void triggerInitialStoreRead();
void sendClientOldEntry();
void buildMaxBodySize(HttpReply * reply);
+ void purgeAllCached();
StoreEntry *old_entry;
/*
- * $Id: client_side_request.cc,v 1.100 2007/12/17 02:21:53 amosjeffries Exp $
+ * $Id: client_side_request.cc,v 1.101 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
* determined by the user
*/
int /* returns nonzero on failure */
-clientBeginRequest(method_t method, char const *url, CSCB * streamcallback,
+clientBeginRequest(const HttpRequestMethod& method, char const *url, CSCB * streamcallback,
CSD * streamdetach, ClientStreamData streamdata, HttpHeader const *header,
char *tailbuf, size_t taillen)
{
err_type page_id;
http_status status;
debugs(85, 2, "The request " <<
- RequestMethodStr[http->request->method] << " " <<
+ RequestMethodStr(http->request->method) << " " <<
http->uri << " is " <<
(answer == ACCESS_ALLOWED ? "ALLOWED" : "DENIED") <<
", because it matched '" <<
{
const char *url = http->uri;
HttpRequest *request = http->request;
- method_t method = request->method;
+ HttpRequestMethod method = request->method;
const wordlist *p = NULL;
/*
}
}
}
+
+ if (METHOD_OTHER == request->method) {
+ no_cache++;
+ }
#endif
if (no_cache) {
void
ClientHttpRequest::processRequest()
{
- debugs(85, 4, "clientProcessRequest: " << RequestMethodStr[request->method] << " '" << uri << "'");
+ debugs(85, 4, "clientProcessRequest: " << RequestMethodStr(request->method) << " '" << uri << "'");
if (request->method == METHOD_CONNECT && !redirect.status) {
logType = LOG_TCP_MISS;
/*
- * $Id: client_side_request.h,v 1.33 2008/01/07 17:12:28 hno Exp $
+ * $Id: client_side_request.h,v 1.34 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#endif
/* client_side_request.c - client side request related routines (pure logic) */
-extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
+extern int clientBeginRequest(const HttpRequestMethod&, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
class MemObject;
/*
- * $Id: errorpage.cc,v 1.228 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: errorpage.cc,v 1.229 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
if (NULL != r) {
Packer p;
str.Printf("%s %s HTTP/%d.%d\n",
- RequestMethodStr[r->method],
+ RequestMethodStr(r->method),
r->urlpath.size() ? r->urlpath.buf() : "/",
r->http_ver.major, r->http_ver.minor);
packerToMemInit(&p, &str);
break;
case 'M':
- p = r ? RequestMethodStr[r->method] : "[unknown method]";
+ p = r ? RequestMethodStr(r->method) : "[unknown method]";
break;
if (NULL != r) {
Packer p;
mb.Printf("%s %s HTTP/%d.%d\n",
- RequestMethodStr[r->method],
+ RequestMethodStr(r->method),
r->urlpath.size() ? r->urlpath.buf() : "/",
r->http_ver.major, r->http_ver.minor);
packerToMemInit(&p, &mb);
/*
- * $Id: external_acl.cc,v 1.81 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: external_acl.cc,v 1.82 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 82 External ACL
* AUTHOR: Henrik Nordstrom, MARA Systems AB
break;
case _external_acl_format::EXT_ACL_METHOD:
- str = RequestMethodStr[request->method];
+ str = RequestMethodStr(request->method);
break;
case _external_acl_format::EXT_ACL_HEADER:
/*
- * $Id: forward.cc,v 1.169 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: forward.cc,v 1.170 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
FwdState::dispatch()
{
peer *p = NULL;
- debugs(17, 3, "fwdDispatch: FD " << client_fd << ": Fetching '" << RequestMethodStr[request->method] << " " << entry->url() << "'" );
+ debugs(17, 3, "fwdDispatch: FD " << client_fd << ": Fetching '" << RequestMethodStr(request->method) << " " << entry->url() << "'" );
/*
* Assert that server_fd is set. This is to guarantee that fwdState
* is attached to something and will be deallocated when server_fd
(int) current_time.tv_sec,
(int) current_time.tv_usec / 1000,
last_status,
- RequestMethodStr[request->method],
+ RequestMethodStr(request->method),
request->canonical);
}
/*
- * $Id: htcp.cc,v 1.78 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: htcp.cc,v 1.79 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 31 Hypertext Caching Protocol
* AUTHOR: Duane Wesssels
htcpUnpackSpecifier(char *buf, int sz)
{
htcpSpecifier *s = new htcpSpecifier;
- method_t method;
+ HttpRequestMethod method;
/* Find length of METHOD */
u_int16_t l = ntohs(*(u_int16_t *) buf);
*/
method = HttpRequestMethod(s->method);
- s->request = HttpRequest::CreateFromUrlAndMethod(s->uri, method == METHOD_NONE ? METHOD_GET : method);
+ s->request = HttpRequest::CreateFromUrlAndMethod(s->uri, method == METHOD_NONE ? HttpRequestMethod(METHOD_GET) : method);
if (s->request)
HTTPMSGLOCK(s->request);
stuff.msg_id = ++msg_id_counter;
- stuff.S.method = (char *) RequestMethodStr[req->method];
+ stuff.S.method = (char *) RequestMethodStr(req->method);
stuff.S.uri = (char *) e->url();
/*
- * $Id: http.cc,v 1.544 2008/01/07 15:16:03 hno Exp $
+ * $Id: http.cc,v 1.545 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
}
int
-httpCachable(method_t method)
+httpCachable(const HttpRequestMethod& method)
{
/* GET and HEAD are cachable. Others are not. */
+ // TODO: replase to HttpRequestMethod::isCachable() ?
if (method != METHOD_GET && method != METHOD_HEAD)
return 0;
* connection.
*/
if (!flags.request_sent) {
- debugs(11, 1, "statusIfComplete: Request not yet fully sent \"" << RequestMethodStr[orig_request->method] << " " << entry->url() << "\"" );
+ debugs(11, 1, "statusIfComplete: Request not yet fully sent \"" << RequestMethodStr(orig_request->method) << " " << entry->url() << "\"" );
return COMPLETE_NONPERSISTENT_MSG;
}
const int offset = mb->size;
HttpVersion httpver(1, 0);
mb->Printf("%s %s HTTP/%d.%d\r\n",
- RequestMethodStr[request->method],
+ RequestMethodStr(request->method),
request->urlpath.size() ? request->urlpath.buf() : "/",
httpver.major,httpver.minor);
/* build and pack headers */
void
httpStart(FwdState *fwd)
{
- debugs(11, 3, "httpStart: \"" << RequestMethodStr[fwd->request->method] << " " << fwd->entry->url() << "\"" );
+ debugs(11, 3, "httpStart: \"" << RequestMethodStr(fwd->request->method) << " " << fwd->entry->url() << "\"" );
HttpStateData *httpState = new HttpStateData(fwd);
if (!httpState->sendRequest()) {
/*
- * $Id: peer_select.cc,v 1.148 2007/12/14 23:11:47 amosjeffries Exp $
+ * $Id: peer_select.cc,v 1.149 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
if (entry)
debugs(44, 3, "peerSelect: " << entry->url() );
else
- debugs(44, 3, "peerSelect: " << RequestMethodStr[request->method]);
+ debugs(44, 3, "peerSelect: " << RequestMethodStr(request->method));
psstate = new ps_state;
{
StoreEntry *entry = ps->entry;
HttpRequest *request = ps->request;
- debugs(44, 3, "peerSelectFoo: '" << RequestMethodStr[request->method] << " " << request->GetHost() << "'");
+ debugs(44, 3, "peerSelectFoo: '" << RequestMethodStr(request->method) << " " << request->GetHost() << "'");
if (ps->direct == DIRECT_UNKNOWN) {
if (ps->always_direct == 0 && Config.accessList.AlwaysDirect) {
peer *p;
HttpRequest *request = ps->request;
hier_code code = HIER_NONE;
- debugs(44, 3, "peerGetSomeParent: " << RequestMethodStr[request->method] << " " << request->GetHost());
+ debugs(44, 3, "peerGetSomeParent: " << RequestMethodStr(request->method) << " " << request->GetHost());
if (ps->direct == DIRECT_YES)
return;
/*
- * $Id: protos.h,v 1.551 2007/12/14 23:11:47 amosjeffries Exp $
+ * $Id: protos.h,v 1.552 2008/01/20 08:54:28 amosjeffries Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
SQUIDCEXTERN void fvdbCountForw(const char *key);
#endif
#if HEADERS_LOG
-SQUIDCEXTERN void headersLog(int cs, int pq, method_t m, void *data);
+SQUIDCEXTERN void headersLog(int cs, int pq, const HttpRequestMethod& m, void *data);
#endif
SQUIDCEXTERN char *log_quote(const char *header);
SQUIDCEXTERN int logTypeIsATcpHit(log_type);
SQUIDCEXTERN void whoisStart(FwdState *);
/* http.c */
-SQUIDCEXTERN int httpCachable(method_t);
+SQUIDCEXTERN int httpCachable(const HttpRequestMethod&);
SQUIDCEXTERN void httpStart(FwdState *);
SQUIDCEXTERN mb_size_t httpBuildRequestPrefix(HttpRequest * request,
HttpRequest * orig_request,
SQUIDCEXTERN void storeKeyFree(const cache_key *);
SQUIDCEXTERN const cache_key *storeKeyScan(const char *);
SQUIDCEXTERN const char *storeKeyText(const cache_key *);
-SQUIDCEXTERN const cache_key *storeKeyPublic(const char *, const method_t);
+SQUIDCEXTERN const cache_key *storeKeyPublic(const char *, const HttpRequestMethod&);
SQUIDCEXTERN const cache_key *storeKeyPublicByRequest(HttpRequest *);
-SQUIDCEXTERN const cache_key *storeKeyPublicByRequestMethod(HttpRequest *, const method_t);
-SQUIDCEXTERN const cache_key *storeKeyPrivate(const char *, method_t, int);
+SQUIDCEXTERN const cache_key *storeKeyPublicByRequestMethod(HttpRequest *, const HttpRequestMethod&);
+SQUIDCEXTERN const cache_key *storeKeyPrivate(const char *, const HttpRequestMethod&, int);
SQUIDCEXTERN int storeKeyHashBuckets(int);
SQUIDCEXTERN int storeKeyNull(const cache_key *);
SQUIDCEXTERN void storeKeyInit(void);
SQUIDCEXTERN protocol_t urlParseProtocol(const char *, const char *e = NULL);
SQUIDCEXTERN void urlInitialize(void);
-SQUIDCEXTERN HttpRequest *urlParse(method_t, char *, HttpRequest *request = NULL);
+SQUIDCEXTERN HttpRequest *urlParse(const HttpRequestMethod&, char *, HttpRequest *request = NULL);
SQUIDCEXTERN const char *urlCanonical(HttpRequest *);
SQUIDCEXTERN char *urlRInternal(const char *host, u_short port, const char *dir, const char *name);
SQUIDCEXTERN char *urlInternal(const char *dir, const char *name);
/*
- * $Id: redirect.cc,v 1.123 2007/12/14 23:11:48 amosjeffries Exp $
+ * $Id: redirect.cc,v 1.124 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 61 Redirector
* AUTHOR: Duane Wessels
if (!r->client_ident)
r->client_ident = dash_str;
- r->method_s = RequestMethodStr[http->request->method];
+ r->method_s = RequestMethodStr(http->request->method);
r->handler = handler;
/*
- * $Id: store.cc,v 1.618 2007/08/30 19:26:10 hno Exp $
+ * $Id: store.cc,v 1.619 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
}
void
-StoreEntry::getPublicByRequestMethod (StoreClient *aClient, HttpRequest * request, const method_t method)
+StoreEntry::getPublicByRequestMethod (StoreClient *aClient, HttpRequest * request, const HttpRequestMethod& method)
{
assert (aClient);
StoreEntry *result = storeGetPublicByRequestMethod( request, method);
}
void
-StoreEntry::getPublic (StoreClient *aClient, const char *uri, const method_t method)
+StoreEntry::getPublic (StoreClient *aClient, const char *uri, const HttpRequestMethod& method)
{
assert (aClient);
StoreEntry *result = storeGetPublic (uri, method);
}
StoreEntry *
-storeGetPublic(const char *uri, const method_t method)
+storeGetPublic(const char *uri, const HttpRequestMethod& method)
{
return Store::Root().get(storeKeyPublic(uri, method));
}
StoreEntry *
-storeGetPublicByRequestMethod(HttpRequest * req, const method_t method)
+storeGetPublicByRequestMethod(HttpRequest * req, const HttpRequestMethod& method)
{
return Store::Root().get(storeKeyPublicByRequestMethod(req, method));
}
}
StoreEntry *
-storeCreateEntry(const char *url, const char *log_url, request_flags flags, method_t method)
+storeCreateEntry(const char *url, const char *log_url, request_flags flags, const HttpRequestMethod& method)
{
StoreEntry *e = NULL;
MemObject *mem = NULL;
/*
- * $Id: store_key_md5.cc,v 1.36 2007/11/15 16:47:35 wessels Exp $
+ * $Id: store_key_md5.cc,v 1.37 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 20 Storage Manager MD5 Cache Keys
* AUTHOR: Duane Wessels
}
const cache_key *
-storeKeyPrivate(const char *url, method_t method, int id)
+storeKeyPrivate(const char *url, const HttpRequestMethod& method, int id)
{
static cache_key digest[SQUID_MD5_DIGEST_LENGTH];
SquidMD5_CTX M;
assert(id > 0);
- debugs(20, 3, "storeKeyPrivate: " << RequestMethodStr[method] << " " << url);
+ debugs(20, 3, "storeKeyPrivate: " << RequestMethodStr(method) << " " << url);
SquidMD5Init(&M);
SquidMD5Update(&M, (unsigned char *) &id, sizeof(id));
SquidMD5Update(&M, (unsigned char *) &method, sizeof(method));
}
const cache_key *
-storeKeyPublic(const char *url, const method_t method)
+storeKeyPublic(const char *url, const HttpRequestMethod& method)
{
static cache_key digest[SQUID_MD5_DIGEST_LENGTH];
unsigned char m = (unsigned char) method;
}
const cache_key *
-storeKeyPublicByRequestMethod(HttpRequest * request, const method_t method)
+storeKeyPublicByRequestMethod(HttpRequest * request, const HttpRequestMethod& method)
{
static cache_key digest[SQUID_MD5_DIGEST_LENGTH];
unsigned char m = (unsigned char) method;
/*
- * $Id: store_log.cc,v 1.36 2007/12/14 23:11:48 amosjeffries Exp $
+ * $Id: store_log.cc,v 1.37 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 20 Storage Manager Logging Functions
* AUTHOR: Duane Wessels
reply->content_type.size() ? reply->content_type.buf() : "unknown",
reply->content_length,
e->contentLen(),
- RequestMethodStr[mem->method],
+ RequestMethodStr(mem->method),
mem->log_url);
} else {
/* no mem object. Most RELEASE cases */
/*
- * $Id: test_cache_digest.cc,v 1.34 2007/11/15 16:47:35 wessels Exp $
+ * $Id: test_cache_digest.cc,v 1.35 2008/01/20 08:54:28 amosjeffries Exp $
*
* AUTHOR: Alex Rousskov
*
};
/* copied from url.c */
-static method_t
+static HttpRequestMethod
methodStrToId(const char *s)
{
if (strcasecmp(s, "GET") == 0) {
RawAccessLogEntry *entry;
char *url;
char *method;
- method_t method_id = METHOD_NONE;
+ HttpRequestMethod method_id = METHOD_NONE;
char *hier = NULL;
assert(fi);
/*
- * $Id: stub_HttpReply.cc,v 1.4 2007/08/13 17:20:58 hno Exp $
+ * $Id: stub_HttpReply.cc,v 1.5 2008/01/20 08:54:33 amosjeffries Exp $
*
* DEBUG: section 84 Helper process maintenance
* AUTHOR: Robert Collins
}
bool
-HttpReply::expectingBody(method_t, int64_t&) const
+HttpReply::expectingBody(const HttpRequestMethod&, int64_t&) const
{
fatal ("Not implemented");
return false;
/*
- * $Id: stub_HttpRequest.cc,v 1.4 2007/08/13 17:20:58 hno Exp $
+ * $Id: stub_HttpRequest.cc,v 1.5 2008/01/20 08:54:33 amosjeffries Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Robert Collins
fatal("Not implemented");
}
-HttpRequest::HttpRequest(method_t method, protocol_t protocol, const char *aUrlpath) : HttpMsg(hoRequest)
+HttpRequest::HttpRequest(const HttpRequestMethod& method, protocol_t protocol, const char *aUrlpath) : HttpMsg(hoRequest)
{
fatal("Not implemented");
}
}
bool
-HttpRequest::expectingBody(method_t unused, int64_t&) const
+HttpRequest::expectingBody(const HttpRequestMethod& unused, int64_t&) const
{
fatal("Not implemented");
return false;
}
void
-HttpRequest::initHTTP(method_t aMethod, protocol_t aProtocol, const char *aUrlpath)
+HttpRequest::initHTTP(const HttpRequestMethod& aMethod, protocol_t aProtocol, const char *aUrlpath)
{
fatal("Not implemented");
}
CPPUNIT_ASSERT(METHOD_NONE == HttpRequestMethod(NULL));
/* parsing a literal should work */
CPPUNIT_ASSERT(METHOD_GET == HttpRequestMethod("GET", NULL));
+ CPPUNIT_ASSERT(METHOD_OTHER == HttpRequestMethod("QWERTY", NULL));
}
/*
/*
- * $Id: tunnel.cc,v 1.176 2007/12/14 23:11:48 amosjeffries Exp $
+ * $Id: tunnel.cc,v 1.177 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
}
}
- debugs(26, 3, "tunnelStart: '" << RequestMethodStr[request->method] << " " << url << "'");
+ debugs(26, 3, "tunnelStart: '" << RequestMethodStr(request->method) << " " << url << "'");
statCounter.server.all.requests++;
statCounter.server.other.requests++;
/* Create socket. */
/*
- * $Id: url.cc,v 1.163 2007/12/14 23:11:48 amosjeffries Exp $
+ * $Id: url.cc,v 1.164 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
#include "HttpRequest.h"
#include "URLScheme.h"
-static HttpRequest *urnParse(method_t method, char *urn);
+static HttpRequest *urnParse(const HttpRequestMethod& method, char *urn);
static const char valid_hostname_chars_u[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
* being "end of host with implied path of /".
*/
HttpRequest *
-urlParse(method_t method, char *url, HttpRequest *request)
+urlParse(const HttpRequestMethod& method, char *url, HttpRequest *request)
{
LOCAL_ARRAY(char, proto, MAX_URL);
LOCAL_ARRAY(char, login, MAX_URL);
}
static HttpRequest *
-urnParse(method_t method, char *urn)
+urnParse(const HttpRequestMethod& method, char *urn)
{
debugs(50, 5, "urnParse: " << urn);
return new HttpRequest(method, PROTO_URN, urn + 4);
/*
- * $Id: urn.cc,v 1.108 2007/12/14 23:11:48 amosjeffries Exp $
+ * $Id: urn.cc,v 1.109 2008/01/20 08:54:28 amosjeffries Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
url_entry;
static STCB urnHandleReply;
-static url_entry *urnParseReply(const char *inbuf, method_t);
+static url_entry *urnParseReply(const char *inbuf, const HttpRequestMethod&);
static const char *const crlf = "\r\n";
static QS url_entry_sort;
}
static url_entry *
-urnFindMinRtt(url_entry * urls, method_t m, int *rtt_ret)
+urnFindMinRtt(url_entry * urls, const HttpRequestMethod& m, int *rtt_ret)
{
int min_rtt = 0;
url_entry *u = NULL;
}
static url_entry *
-urnParseReply(const char *inbuf, method_t m)
+urnParseReply(const char *inbuf, const HttpRequestMethod& m)
{
char *buf = xstrdup(inbuf);
char *token;