Fixed memory leaks related to Range requests.
HttpRequest::range field could be cleared without destroying HttpHdrRange
object in clientInterpretRequestHeaders().
The range field is essentially a cached value of the parsed Range header.
Managing the cache outside its owner object is a bad idea.
/* ignore range header in non-GETs or non-HEADs */
if (request->method == METHOD_GET || request->method == METHOD_HEAD) {
- request->range = req_hdr->getRange();
+ // XXX: initialize if we got here without HttpRequest::parseHeader()
+ if (!request->range)
+ request->range = req_hdr->getRange();
if (request->range) {
request->flags.range = 1;
else {
req_hdr->delById(HDR_RANGE);
req_hdr->delById(HDR_REQUEST_RANGE);
+ delete request->range;
request->range = NULL;
}