]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alexey Veselovsky <alexey.veselovsky@eykontech.com>
authoramosjeffries <>
Sun, 20 Jan 2008 15:54:28 +0000 (15:54 +0000)
committeramosjeffries <>
Sun, 20 Jan 2008 15:54:28 +0000 (15:54 +0000)
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.

43 files changed:
src/ACLMethod.cc
src/ACLMethod.h
src/ACLMethodData.cc
src/ACLMethodData.h
src/AccessLogEntry.h
src/HttpMsg.h
src/HttpReply.cc
src/HttpReply.h
src/HttpRequest.cc
src/HttpRequest.h
src/HttpRequestMethod.cc
src/HttpRequestMethod.h
src/ICAP/ICAPModXact.cc
src/MemObject.cc
src/MemObject.h
src/SquidString.h
src/Store.h
src/access_log.cc
src/acl.cc
src/auth/digest/auth_digest.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_reply.h
src/client_side_request.cc
src/client_side_request.h
src/errorpage.cc
src/external_acl.cc
src/forward.cc
src/htcp.cc
src/http.cc
src/peer_select.cc
src/protos.h
src/redirect.cc
src/store.cc
src/store_key_md5.cc
src/store_log.cc
src/test_cache_digest.cc
src/tests/stub_HttpReply.cc
src/tests/stub_HttpRequest.cc
src/tests/testHttpRequestMethod.cc
src/tunnel.cc
src/url.cc
src/urn.cc

index 7639b6fcf016dc07709dc704c1b0133ebc24e9d1..d046cac055635363505f6d04fd5bb989a78ddac7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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)
index 631c561285c2a72691ee53af6c5cec3aa5c88044..9d9b026d45d08b702adfd22cc237a59b6e13b4d8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -38,7 +38,7 @@
 #include "ACLStrategy.h"
 #include "ACLStrategised.h"
 
-class ACLMethodStrategy : public ACLStrategy<method_t>
+class ACLMethodStrategy : public ACLStrategy<HttpRequestMethod>
 {
 
 public:
@@ -63,7 +63,7 @@ class ACLMethod
 
 private:
     static ACL::Prototype RegistryProtoype;
-    static ACLStrategised<method_t> RegistryEntry_;
+    static ACLStrategised<HttpRequestMethod> RegistryEntry_;
 };
 
 #endif /* SQUID_ACLMETHOD_H */
index 427b8ff1931ce4a8b1d52262e1638bf922eae022..5999538448e27021c981593bc34e98c4f99d3185 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -55,24 +55,24 @@ ACLMethodData::~ACLMethodData()
 }
 
 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;
     }
 
@@ -82,14 +82,14 @@ ACLMethodData::dump()
 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;
     }
@@ -101,7 +101,7 @@ ACLMethodData::empty() const
     return values == NULL;
 }
 
-ACLData<method_t> *
+ACLData<HttpRequestMethod> *
 ACLMethodData::clone() const
 {
     assert (!values);
index d394d981bc4ffe04f4e2a0881e5d2d7872cbec70..9082e77ebabd12b3f0b9738065818e210ed61a44 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -39,7 +39,7 @@
 #include "ACLData.h"
 #include "List.h"
 
-class ACLMethodData : public ACLData<method_t>
+class ACLMethodData : public ACLData<HttpRequestMethod>
 {
 
 public:
@@ -49,13 +49,13 @@ 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)
index 6e5367259501b6c82a7f2e5ac2310d1640913a3a..1fec6fce6aa0722448a8af112b8bc9b5b7db7f66 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -57,7 +57,7 @@ public:
     public:
         HttpDetails() : method(METHOD_NONE), code(0), content_type(NULL) {}
 
-        method_t method;
+        HttpRequestMethod method;
         int code;
         const char *content_type;
         HttpVersion version;
index 719c00a6b7744d98d7c7b1da08dade0075fab16d..842333bc08e9ebfcfd9dad1eaacc761b542abf4f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -86,7 +86,7 @@ public:
 
     virtual int httpMsgParseError();
 
-    virtual bool expectingBody(method_t, int64_t&) const = 0;
+    virtual bool expectingBody(const HttpRequestMethod&, int64_t&) const = 0;
 
     void firstLineBuf(MemBuf&);
 
index 36e97b3ed0af7d995bce7dc72203f53b69f86c98..40aee3e644e5ac7b861d90466ca2f5bdf247af80 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -416,7 +416,7 @@ HttpReply::hdrCacheClean()
  * 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;
@@ -470,7 +470,7 @@ HttpReply::httpMsgParseError()
  * 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;
 
index 6dfb3d0705d855eb5a1ae67dbe336230ab22ed7a..6230d05d019d93c79009a7dddea743526f4a39a7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -97,7 +97,7 @@ public:
 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);
 
@@ -116,7 +116,7 @@ public:
 
     void redirect(http_status, const char *);
 
-    int64_t bodySize(method_t) const;
+    int64_t bodySize(const HttpRequestMethod&) const;
 
     int validatorsMatch (HttpReply const *other) const;
 
index ddd416b0fc2fe3d14611a0c893341e7931af0308..36f878ecd9cbdacb8713507e89d31dc46a5c7dd0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -46,7 +46,7 @@ HttpRequest::HttpRequest() : HttpMsg(hoRequest)
     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);
@@ -58,7 +58,7 @@ HttpRequest::~HttpRequest()
 }
 
 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;
@@ -238,7 +238,7 @@ HttpRequest::pack(Packer * p)
     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 */
@@ -259,7 +259,7 @@ httpRequestPack(void *obj, Packer *p)
 int
 HttpRequest::prefixLen()
 {
-    return strlen(RequestMethodStr[method]) + 1 +
+    return strlen(RequestMethodStr(method)) + 1 +
            urlpath.size() + 1 +
            4 + 1 + 3 + 2 +
            header.len + 2;
@@ -358,7 +358,7 @@ void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const
 {
     // 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);
 }
@@ -368,7 +368,7 @@ void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const
  * 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;
 
@@ -407,7 +407,7 @@ HttpRequest::expectingBody(method_t unused, int64_t& theSize) const
  * 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);
 }
@@ -437,17 +437,9 @@ HttpRequest::cacheable() const
      * 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
@@ -457,7 +449,7 @@ HttpRequest::cacheable() const
         return gopherCachable(this);
 
     if (protocol == PROTO_CACHEOBJ)
-        return 0;
+        return false;
 
-    return 1;
+    return true;
 }
index f19344fb528a668256dc98e8b47e2ddfcecae4a9..74a9cea2addb36f58c2a71be7547d7bf4fa913f7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -53,7 +53,7 @@ class HttpRequest: public HttpMsg
 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();
 
@@ -63,7 +63,7 @@ public:
         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;
@@ -92,7 +92,7 @@ protected:
     void init();
 
 public:
-    method_t method;
+    HttpRequestMethod method;
 
     char login[MAX_LOGIN_SZ];
 
@@ -151,7 +151,7 @@ public:
 
     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
 
@@ -163,7 +163,7 @@ public:
 
     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);
 
index 2781c5610ca709fd867b603126d3bbd3cdd0f51c..aa3f41c17e107f59d4ede2a5994f338fda1cb190 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -38,7 +38,7 @@
 #include "HttpRequestMethod.h"
 #include "wordlist.h"
 
-const char *RequestMethodStr[] =
+const char* HttpRequestMethod::RequestMethodStr[] =
     {
         "NONE",
         "GET",
@@ -94,10 +94,10 @@ const char *RequestMethodStr[] =
     };
 
 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;
 }
 
@@ -127,20 +127,27 @@ HttpRequestMethod::HttpRequestMethod(char const *begin, char const *end) : theMe
      */
     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])) {
@@ -178,3 +185,38 @@ HttpRequestMethod::Configure(SquidConfig &Config)
         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;
+}
index 582a293a10e2f5cfedc2542bb1624ecdc7886315..9616920cf3f969edca4123cfbb99f360786708d9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -87,13 +87,10 @@ enum _method_t {
     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;
@@ -113,33 +110,76 @@ public:
 
     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 */
index 3cb5d6197866205af5a1feded0f940a551df4a4d..4aaf7f49551c73c8d4d64f7d1c0dddcc073c54ce 100644 (file)
@@ -1356,7 +1356,7 @@ void ICAPModXact::estimateVirginBody()
     HttpMsg *msg = virgin.header;
     Must(msg);
 
-    method_t method;
+    HttpRequestMethod method;
 
     if (virgin.cause)
         method = virgin.cause->method;
index 9ac3633626ee39a4f5ab664d93e3793de32446ac..2966c1a10ad7449d4ff4935cba94db1d2ed4a911 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -214,7 +214,7 @@ void
 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",
index 1b204610c9ae9547eb8cf02d026c18616ad28f3e..765d96b6bda180809a43f1138fc1bd2493d7dd00 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -90,7 +90,7 @@ public:
     void checkUrlChecksum() const;
 #endif
 
-    method_t method;
+    HttpRequestMethod method;
     char *url;
     mem_hdr data_hdr;
     int64_t inmem_lo;
index 9d31866fcb8397d2082f0cda537b7e37b6106799..082605e9677349e37298988c4b4b02fa0a0183b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -35,6 +35,7 @@
 #ifndef SQUID_STRING_H
 #define SQUID_STRING_H
 
+
 /* forward decls */
 
 class CacheManager;
index ffd08638b017d9ad3892d9911b27b39a45421013..e159d940b53373992a4dbdeaed3b7d922827f484 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -153,9 +153,9 @@ swap_status_t swap_status:
 
 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()
     {
@@ -304,10 +304,10 @@ SQUIDCEXTERN size_t storeEntryInUse();
 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);
index bc010f16874beab483dc5dfeb953aaf51bc217c4..5382d4f5e320a5ea8f4f10a7673716dde76151d7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -1408,7 +1408,7 @@ accessLogLog(AccessLogEntry * al, ACLChecklist * checklist)
     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);
@@ -1783,7 +1783,7 @@ mcast_encode(unsigned int *ibuf, size_t isize, const unsigned int *key)
 
 #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;
index 52200f1b78594bb06231dc0318cbce9362d91d77..a61859237c3c9e20036941098fff562a63acd11f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -330,7 +330,7 @@ acl_access::containsPURGE() const
 
     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");
index 63ade9a1adaa40a52185362c21a10440717b65c7..09742bfa94ee9b705e0607d69536cbfeec96b8c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -617,7 +617,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointe
                   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 << "'");
 
@@ -638,7 +638,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointe
              */
             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);
index 8ee8a62c7914d41ad7a88a5569bc60f4eeeca6c8..a0824505411f398df546e78dc9d16f9cafae365e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -130,7 +130,7 @@ static PF requestTimeout;
 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
@@ -655,7 +655,7 @@ clientSetKeepaliveFlag(ClientHttpRequest * http)
     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... */
@@ -1832,7 +1832,7 @@ prepareTransparentURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
  *  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;
@@ -1891,7 +1891,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
     }
 
     /* 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" */
@@ -2136,7 +2136,7 @@ clientAfterReadingRequests(int fd, ConnStateData::Pointer &conn, int do_next_rea
 }
 
 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;
@@ -2356,7 +2356,7 @@ ConnStateData::bodySizeLeft()
 static bool
 clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
 {
-    method_t method;
+    HttpRequestMethod method;
     ClientSocketContext *context;
     bool parsed_req = false;
     HttpVersion http_ver;
index 91f11bf5ea3b175ae1f297dc4e1349e896a59b6d..280b369a8da917b841e92f38b066885379e99314 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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)
@@ -88,7 +88,7 @@ clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) : http
  */
 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)
 {
@@ -657,7 +657,7 @@ clientReplyContext::processMiss()
     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.
@@ -677,6 +677,11 @@ clientReplyContext::processMiss()
         purgeRequest();
         return;
     }
+    
+    if (METHOD_OTHER == r->method) {
+       // invalidate all cache entries
+       purgeAllCached();
+    }
 
     if (http->onlyIfCached()) {
         processOnlyIfCachedMiss();
@@ -694,7 +699,7 @@ clientReplyContext::processMiss()
         triggerInitialStoreRead();
         return;
     } else {
-        assert(http->out.offset == 0);
+        assert(http->out.offset == 0);        
         createStoreEntry(r->method, r->flags);
         triggerInitialStoreRead();
 
@@ -732,7 +737,7 @@ clientReplyContext::processOnlyIfCachedMiss()
 {
     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);
@@ -741,13 +746,37 @@ clientReplyContext::processOnlyIfCachedMiss()
 
 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)
 {
@@ -1792,7 +1821,7 @@ clientReplyContext::ProcessReplyAccessResult (int rv, void *voidMe)
 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 '" 
@@ -1996,7 +2025,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
 /* 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);
     /*
index dbc465f3d25f20b2ef2532d55e2512906a2cb7b9..cb70baf01d0a45b91b877851bd316024f4d87b20 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -76,8 +76,8 @@ public:
     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);
@@ -143,6 +143,7 @@ private:
     void triggerInitialStoreRead();
     void sendClientOldEntry();
     void buildMaxBodySize(HttpReply * reply);
+    void purgeAllCached();
 
 
     StoreEntry *old_entry;
index 81948809b2b5d0e30020fb642a725cf82fbfb348..16782ab2db6e8abe8d77964bddf1a9a1afb9a970 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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)
@@ -271,7 +271,7 @@ ClientHttpRequest::~ClientHttpRequest()
  * 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)
 {
@@ -400,7 +400,7 @@ ClientRequestContext::clientAccessCheckDone(int answer)
     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 '" << 
@@ -553,7 +553,7 @@ clientHierarchical(ClientHttpRequest * http)
 {
     const char *url = http->uri;
     HttpRequest *request = http->request;
-    method_t method = request->method;
+    HttpRequestMethod method = request->method;
     const wordlist *p = NULL;
 
     /*
@@ -656,6 +656,10 @@ clientInterpretRequestHeaders(ClientHttpRequest * http)
             }
         }
     }
+    
+    if (METHOD_OTHER == request->method) {
+       no_cache++;
+    }
 
 #endif
     if (no_cache) {
@@ -882,7 +886,7 @@ ClientRequestContext::checkNoCacheDone(int answer)
 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;
index d9a242e377765162db31e1f8f39e91325e3401cd..5234b0a7d04e366bfdbc679e296b1ecebc3fdb0a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -50,7 +50,7 @@ class HttpMsg;
 #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;
 
index 1f2da04f4f95e080e660e58aca8f48777eb62a5f..d3444b69636a850228b3af49d3ac99f61c94b283 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -535,7 +535,7 @@ errorDump(ErrorState * err, MemBuf * mb)
     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);
@@ -714,7 +714,7 @@ errorConvert(char token, ErrorState * err)
         break;
 
     case 'M':
-        p = r ? RequestMethodStr[r->method] : "[unknown method]";
+        p = r ? RequestMethodStr(r->method) : "[unknown method]";
 
         break;
 
@@ -741,7 +741,7 @@ errorConvert(char token, ErrorState * err)
         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);
index c7fb9c6113a5da99143a3ceec0ebe2933ace6118..4e717d474a4a6f2b21ab89e9b3004a7cf98a424f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -849,7 +849,7 @@ makeExternalAclKey(ACLChecklist * ch, external_acl_data * acl_data)
             break;
 
         case _external_acl_format::EXT_ACL_METHOD:
-            str = RequestMethodStr[request->method];
+            str = RequestMethodStr(request->method);
             break;
 
         case _external_acl_format::EXT_ACL_HEADER:
index 0da586558fd8a8b2aed9f9c5fda40e1f6dc4d247..920e1d015f08e1ce343f30440a359551fbd1e1a4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -939,7 +939,7 @@ void
 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
@@ -1296,7 +1296,7 @@ FwdState::log()
                   (int) current_time.tv_sec,
                   (int) current_time.tv_usec / 1000,
                   last_status,
-                  RequestMethodStr[request->method],
+                  RequestMethodStr(request->method),
                   request->canonical);
 }
 
index 0455090d8c6b367e3979bdafde97bef576206987..df63c4a4a95ed05581b5141ad09dafba593882ce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -661,7 +661,7 @@ static htcpSpecifier *
 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);
@@ -764,7 +764,7 @@ htcpUnpackSpecifier(char *buf, int sz)
      */
     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);
@@ -1575,7 +1575,7 @@ htcpQuery(StoreEntry * e, HttpRequest * req, peer * p)
 
     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();
 
index 28a4e011f47bd60eae5b6e3af76bc13fb8b73221..e8c91f002e1a8e65a10dd50d0f9fc5bb94922804 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -171,10 +171,11 @@ httpStateFree(int fd, void *data)
 }
 
 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;
 
@@ -879,7 +880,7 @@ HttpStateData::statusIfComplete() const
      * 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;
     }
 
@@ -1734,7 +1735,7 @@ HttpStateData::buildRequestPrefix(HttpRequest * request,
     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 */
@@ -1818,7 +1819,7 @@ HttpStateData::sendRequest()
 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()) {
index 76a65aca57c7a10bb080201656cafbe5e259810e..cb1904f6086048f7732fcd9013365d9cb3d46e53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -159,7 +159,7 @@ peerSelect(HttpRequest * request,
     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;
 
@@ -288,7 +288,7 @@ peerSelectFoo(ps_state * ps)
 {
     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) {
@@ -500,7 +500,7 @@ peerGetSomeParent(ps_state * ps)
     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;
index 11023aaafe7966fe155b5399d1743ccd0f543751..0d4d07d3ef635beed763aa8955fd28bedc63eab0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -53,7 +53,7 @@ SQUIDCEXTERN void fvdbCountVia(const char *key);
 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);
@@ -189,7 +189,7 @@ SQUIDCEXTERN int gopherCachable(const HttpRequest *);
 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,
@@ -526,10 +526,10 @@ SQUIDCEXTERN cache_key *storeKeyCopy(cache_key *, const cache_key *);
 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);
@@ -623,7 +623,7 @@ SQUIDCEXTERN void unlinkdUnlink(const char *);
 
 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);
index cba04a10ad5afd81d02a8b958555e37dd99ceecf..4f0105c06151d319e8c0eb1b284ccc4a5926c990 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -157,7 +157,7 @@ redirectStart(ClientHttpRequest * http, RH * handler, void *data)
     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;
 
index a6b6b8a0188e2f3100d90183714e5bf42efa7289..d7fa8c0cceb9a6cf561efbd81a8f51fa9d9aebeb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -520,7 +520,7 @@ StoreEntry::unlock()
 }
 
 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);
@@ -544,7 +544,7 @@ StoreEntry::getPublicByRequest (StoreClient *aClient, HttpRequest * request)
 }
 
 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);
@@ -556,13 +556,13 @@ StoreEntry::getPublic (StoreClient *aClient, const char *uri, const method_t met
 }
 
 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));
 }
@@ -747,7 +747,7 @@ StoreEntry::setPublicKey()
 }
 
 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;
index 1fdfed2ea5724c99d0a2e54419cbe921d9e02886..d60c8f87042509ebb6af22ad47416f7fc156ca85 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -99,12 +99,12 @@ storeKeyHashHash(const void *key, unsigned int n)
 }
 
 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));
@@ -114,7 +114,7 @@ storeKeyPrivate(const char *url, method_t method, int id)
 }
 
 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;
@@ -133,7 +133,7 @@ storeKeyPublicByRequest(HttpRequest * request)
 }
 
 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;
index 7a0a992e1b55c7fa0fc99e627bbee5728225ad14..dfa95feeb0368c0a463c85eabfe1736c6d2d3300 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -90,7 +90,7 @@ storeLog(int tag, const StoreEntry * e)
                       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 */
index afb30573800ee7a1ccfbccff97dfccdf4a3aa711..3b15ab7ca10caab315aac6e585d94290119a74a6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
  *
@@ -124,7 +124,7 @@ const char *RequestMethodStr[] =
     };
 
 /* copied from url.c */
-static method_t
+static HttpRequestMethod
 methodStrToId(const char *s)
 {
     if (strcasecmp(s, "GET") == 0) {
@@ -431,7 +431,7 @@ accessLogReader(FileIterator * fi)
     RawAccessLogEntry *entry;
     char *url;
     char *method;
-    method_t method_id = METHOD_NONE;
+    HttpRequestMethod method_id = METHOD_NONE;
     char *hier = NULL;
 
     assert(fi);
index 6afc0d2d9f609d870793a08c7e1dadeb6bc2ca88..94ba11599aefebbb3f42152076dc807febb67dac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -90,7 +90,7 @@ HttpReply::httpMsgParseError()
 }
 
 bool
-HttpReply::expectingBody(method_t, int64_t&) const
+HttpReply::expectingBody(const HttpRequestMethod&, int64_t&) const
 {
     fatal ("Not implemented");
     return false;
index 5e290d4c4f08b12388f20cc30ef8873a168fc2da..15e2eac81557e84f975eb723e570a01980977734 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -41,7 +41,7 @@ HttpRequest::HttpRequest() : HttpMsg(hoRequest)
     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");
 }
@@ -75,14 +75,14 @@ HttpRequest::reset()
 }
 
 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");
 }
index 7b479ebbe1c18d0d322440bcfb067a040f02d282..d5c73b1856ce25a26ee0713e2763e7fc42f48394 100644 (file)
@@ -20,6 +20,7 @@ testHttpRequestMethod::testConstructCharStart()
     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));
 }
 
 /*
index ed3a1a7582f0a25ef5dd539c1552913701c890c7..925791ff2ca7461c5afe2d91565df562ab1b7f13 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -629,7 +629,7 @@ tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr)
         }
     }
 
-    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. */
index c747eeed8beafd26a4072e754dd6eb2abdcab07b..8cfdf4dbaa192350737ca64f71def10d47b2dc9e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -37,7 +37,7 @@
 #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"
@@ -196,7 +196,7 @@ urlDefaultPort(protocol_t p)
  * 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);
@@ -420,7 +420,7 @@ urlParse(method_t method, char *url, HttpRequest *request)
 }
 
 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);
index d8db3baf491f9b718e501bedccc7929526410ccb..5378178bd771c15c37eeecb30ad5d15e611490af 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -100,7 +100,7 @@ typedef struct
 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;
 
@@ -128,7 +128,7 @@ UrnState::~UrnState ()
 }
 
 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;
@@ -476,7 +476,7 @@ error:
 }
 
 static url_entry *
-urnParseReply(const char *inbuf, method_t m)
+urnParseReply(const char *inbuf, const HttpRequestMethod& m)
 {
     char *buf = xstrdup(inbuf);
     char *token;