MCPcopy Create free account
hub / github.com/apache/trafficserver / ContentRange

Class ContentRange

plugins/slice/ContentRange.h:27–55  ·  view source on GitHub ↗

represents value parsed from a blocked Content-Range response header field. Range is converted from closed range into a half open range for. */

Source from the content-addressed store, hash-verified

25 Range is converted from closed range into a half open range for.
26 */
27struct ContentRange {
28 int64_t m_beg{-1};
29 int64_t m_end{-1}; // half open
30 int64_t m_length{-1}; // full content length
31
32 ContentRange() {}
33 explicit ContentRange(int64_t const begin, int64_t const end, int64_t const len) : m_beg(begin), m_end(end), m_length(len) {}
34
35 bool
36 isValid() const
37 {
38 return 0 <= m_beg && m_beg < m_end && m_end <= m_length;
39 }
40
41 /** parsed from a Content-Range field
42 * Must be null terminated.
43 */
44 bool fromStringClosed(char const *const valstr);
45
46 /** usable for Content-Range field
47 */
48 bool toStringClosed(char *const rangestr, int *const rangelen) const;
49
50 int64_t
51 rangeSize() const
52 {
53 return m_end - m_beg;
54 }
55};

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected