/*
- * Copyright (C) 1996-2015 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.
#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);
/**
* 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
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:
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 */