]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 27 Aug 2010 16:37:37 +0000 (10:37 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 27 Aug 2010 16:37:37 +0000 (10:37 -0600)
Added more comparison operators to HttpVersion.

src/HttpMsg.cc
src/HttpVersion.h

index 3043dbd9dea90d0aa1d69c04ddfd1f5ede1f2093..13760ac756669415cbf48aea783047e51603fdf0 100644 (file)
@@ -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.
index fb19b2b3bf3e03aba2c4d42e4f3608c17a10f18a..ed60074b0f1cc3c7bd7e58a53c8a9718d1398445 100644 (file)
@@ -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 */