From: rousskov <> Date: Sun, 17 Feb 2008 00:41:55 +0000 (+0000) Subject: When METHOD_ENUM_END and METHOD_OTHER were reordered, the rest of the X-Git-Tag: BASIC_TPROXY4~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3dee26195c2f013df6e060dc3df1408341b5656;p=thirdparty%2Fsquid.git When METHOD_ENUM_END and METHOD_OTHER were reordered, the rest of the code was not reviewed and an infinite loop in clientReplyContext::purgeAllCached was created. Polished the ++ operator and added a TODO to replace it eventually. Fixed id() comments. --- diff --git a/src/HttpRequestMethod.h b/src/HttpRequestMethod.h index 1eaf9aebdf..3ebf2e8846 100644 --- a/src/HttpRequestMethod.h +++ b/src/HttpRequestMethod.h @@ -1,5 +1,5 @@ /* - * $Id: HttpRequestMethod.h,v 1.10 2008/02/15 17:26:00 rousskov Exp $ + * $Id: HttpRequestMethod.h,v 1.11 2008/02/16 17:41:55 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -128,23 +128,21 @@ public: return !operator==(aMethod); } - /** Iterate through the registered HTTP methods. */ + /** Iterate through all HTTP method IDs. */ 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; + // TODO: when this operator is used in more than one place, + // replace it with HttpRequestMethods::Iterator API + // XXX: this interface can create METHOD_OTHER without an image + assert(theMethod < METHOD_ENUM_END); + theMethod = (_method_t)(1 + (int)theMethod); + return *this; } /** Get an ID representation of the method. - \retval METHOD_NONE the methopd is currently unset or unknown. - \retval METHOD_OTHER the method has been accepted but is not one of the registerd HTTP methods. - \retval * the method is on of the registered HTTP methods. + \retval METHOD_NONE the method is unset + \retval METHOD_OTHER the method is not recognized and has no unique ID + \retval * the method is on of the recognized HTTP methods. */ _method_t const id() const { return theMethod; }