From: Amos Jeffries Date: Fri, 27 Aug 2010 16:37:37 +0000 (-0600) Subject: Author: Alex Rousskov X-Git-Tag: SQUID_3_1_8~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6123c962c63c406bb5e495c754c19907bee1c8db;p=thirdparty%2Fsquid.git Author: Alex Rousskov Added more comparison operators to HttpVersion. --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index 3043dbd9de..13760ac756 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -321,7 +321,7 @@ HttpMsg::setContentLength(int64_t clen) int httpMsgIsPersistent(HttpVersion const &http_ver, const HttpHeader * hdr) { - if ((http_ver.major >= 1) && (http_ver.minor >= 1)) { + if (http_ver > HttpVersion(1, 0)) { /* * for modern versions of HTTP: persistent unless there is * a "Connection: close" header. diff --git a/src/HttpVersion.h b/src/HttpVersion.h index fb19b2b3bf..ed60074b0f 100644 --- a/src/HttpVersion.h +++ b/src/HttpVersion.h @@ -66,6 +66,23 @@ public: return ((this->major != that.major) || (this->minor != that.minor)); } + bool operator <(const HttpVersion& that) const { + return (this->major < that.major || + (this->major == that.major && this->minor < that.minor)); + } + + bool operator >(const HttpVersion& that) const { + return (this->major > that.major || + (this->major == that.major && this->minor > that.minor)); + } + + bool operator <=(const HttpVersion& that) const { + return !(*this > that); + } + + bool operator >=(const HttpVersion& that) const { + return !(*this < that); + } }; #endif /* SQUID_HTTPVERSION_H */