range: better closing for out of order ranges

Ticket: 5132

In case of a duplicate range, we can return early, because
there is no new data to process.

More importantly, this commit adds a check about wether the file
got closed meanwhile, so that this just completed out of order
range, even if it brings new data, is now irrelevant.
This can happen for instance if there was a gap...
pull/7091/head
Philippe Antoine 3 years ago committed by Victor Julien
parent bfcd6cb46a
commit 3fd8e908f8

@ -493,6 +493,8 @@ File *HttpRangeClose(HttpRangeContainerBlock *c, uint16_t flags)
(void)SC_ATOMIC_SUB(ContainerUrlRangeList.ht->memuse, c->current->buflen);
SCFree(c->current->buffer);
SCFree(c->current);
c->current = NULL;
return NULL;
}
SCLogDebug("inserted range fragment");
c->current = NULL;
@ -500,6 +502,10 @@ File *HttpRangeClose(HttpRangeContainerBlock *c, uint16_t flags)
// we have to wait for the flow owning the file
return NULL;
}
if (c->container->files->tail == NULL) {
// file has already been closed meanwhile
return NULL;
}
// keep on going, maybe this out of order chunk
// became the missing part between open and close
}

Loading…
Cancel
Save