]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/HttpHeaderRange.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / HttpHeaderRange.h
index 85e2b93a66e7f09856ad28b26ab066095f947b42..b9ae4e7b0235180db63e91a390d7a3163321a754 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -9,8 +9,8 @@
 #ifndef SQUID_HTTPHEADERRANGE_H
 #define SQUID_HTTPHEADERRANGE_H
 
+#include "base/Range.h"
 #include "mem/forward.h"
-#include "Range.h"
 #include "SquidString.h"
 
 #include <vector>
 class HttpReply;
 class Packable;
 
-/* http byte-range-spec */
-
+// TODO: Refactor to disambiguate and provide message-specific APIs.
+/// either byte-range-spec (in a request Range header)
+/// or suffix-byte-range-spec (in a request Range header)
+/// or byte-range part of byte-range-resp (in a response Content-Range header)
+/// or "*" part of unsatisfied-range (in a response Content-Range header)
 class HttpHdrRangeSpec
 {
     MEMPROXY_CLASS(HttpHdrRangeSpec);
@@ -42,7 +45,7 @@ public:
 
 /**
  * There may be more than one byte range specified in the request.
- * This object holds all range specs in order of their appearence
+ * This object holds all range specs in order of their appearance
  * in the request because we SHOULD preserve that order.
  */
 class HttpHdrRange
@@ -78,7 +81,6 @@ public:
     int64_t firstOffset() const;
     int64_t lowestOffset(int64_t) const;
     bool offsetLimitExceeded(const int64_t limit) const;
-    bool contains(HttpHdrRangeSpec& r) const;
     std::vector<HttpHdrRangeSpec *> specs;
 
 private:
@@ -100,9 +102,9 @@ public:
     void updateSpec();
     int64_t debt() const;
     void debt(int64_t);
-    int64_t debt_size;      /* bytes left to send from the current spec */
+    int64_t debt_size = 0;  /* bytes left to send from the current spec */
     String boundary;        /* boundary for multipart responses */
-    bool valid;
+    bool valid = false;
 };
 
 #endif /* SQUID_HTTPHEADERRANGE_H */