Go to the documentation of this file.
39 #define known_spec(s) ((s) > HttpHdrRangeSpec::UnknownPosition)
77 if (!((p = strchr(field,
'-')) && (p - field < flen))) {
78 debugs(64, 2,
"invalid (missing '-') range-spec near: '" << field <<
"'");
87 if (p - field < flen) {
95 debugs(64, 2,
"invalid (last-byte-pos < first-byte-pos) range-spec near: " << field);
122 debugs(64, 5,
"HttpHdrRangeSpec::canonize: " << note <<
": [" <<
165 #if MERGING_BREAKS_NOTHING
168 const int64_t donor_rhs = donor->
offset + donor->
length;
181 if (donor->
offset <= rhs && rhs < donor_rhs) {
227 const char *pos =
NULL;
231 debugs(64, 8,
"parsing range field: '" << *range_spec <<
"'");
234 if (range_spec->
caseCmp(
"bytes=", 6))
248 while (!
specs.empty()) {
252 debugs(64, 2,
"ignoring invalid range field: '" << *range_spec <<
"'");
256 specs.push_back(spec);
259 debugs(64, 8,
"got range specs: " <<
specs.size());
260 return !
specs.empty();
265 while (!
specs.empty()) {
286 return specs.begin();
298 return specs.begin();
312 while (pos !=
end()) {
316 (*pos)->packInto(packer);
332 while (i != basis.end()) {
333 if (
specs.size() && (*i)->mergeWith(
specs.back())) {
340 specs.push_back (*i);
344 debugs(64, 3,
"HttpHdrRange::merge: had " << basis.size() <<
345 " specs, merged " << basis.size() -
specs.size() <<
" specs");
354 if ((*pos)->canonize(
clen))
355 copy.push_back (*pos);
360 debugs(64, 3,
"found " <<
specs.size() - copy.size() <<
" bad specs");
389 debugs(64, 3,
"HttpHdrRange::canonize: started with " <<
specs.size() <<
390 " specs, clen: " <<
clen);
391 std::vector<HttpHdrRangeSpec*> goods;
394 debugs(64, 3,
"HttpHdrRange::canonize: finished with " <<
specs.size() <<
396 return specs.size() > 0;
408 while (pos !=
end()) {
410 assert ((*pos)->offset >= 0);
412 if ((*pos)->offset < offset)
415 offset = (*pos)->offset + (*pos)->length;
439 assert ((*pos)->offset >= 0);
441 if ((*pos)->offset < offset)
444 offset = (*pos)->offset;
447 offset += (*pos)->length;
464 while (pos !=
end()) {
465 if ((*pos)->offset < offset || !
known_spec(offset))
466 offset = (*pos)->offset;
486 while (pos !=
end()) {
487 int64_t current = (*pos)->offset;
493 current =
size - (*pos)->length;
560 debugs(64, 3,
"HttpHdrRangeIter::debt: was " <<
debt_size <<
" now " << newDebt);
int caseCmp(char const *) const
static HttpHdrRangeSpec * Create(const char *field, int fieldLen)
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
bool offsetLimitExceeded(const int64_t limit) const
HttpHdrRange::iterator pos
void outputInfo(char const *note) const
virtual void append(const char *buf, int size)=0
Appends a c-string to existing packed data.
int canonize(int64_t clen)
static size_t ParsedCount
void getCanonizedSpecs(std::vector< HttpHdrRangeSpec * > ©)
bool parseInit(const char *field, int flen)
std::vector< HttpHdrRangeSpec * >::iterator iterator
void merge(std::vector< HttpHdrRangeSpec * > &basis)
int64_t firstOffset() const
const HttpHdrRangeSpec * currentSpec() const
char const * termedBuf() const
std::vector< HttpHdrRangeSpec * >::const_iterator const_iterator
static int64_t const UnknownPosition
HttpHdrRange::iterator end
void packInto(Packable *p) const
static HttpHdrRange * ParseCreate(const String *range_spec)
std::vector< HttpHdrRangeSpec * > specs
const HttpHdrContRange * contentRange() const
bool parseInit(const String *range_spec)
bool mergeWith(const HttpHdrRangeSpec *donor)
bool willBeComplex() const
int64_t lowestOffset(int64_t) const
Range intersection(Range const &) const
#define debugs(SECTION, LEVEL, CONTENT)
int strListGetItem(const String *str, char del, const char **item, int *ilen, const char **pos)
void packInto(Packable *p) const