Hi, everyone!
I have a problem with using of custom ResourceHandler when Range request occured.
1. HTTP request for large file downloading is formed on web side with header:
- Code: Select all
Range: bytes=0-
2. My implementation of ResourceHandler make this request and returns response with header:
- Code: Select all
Content-Range: 0-8716288/8769105
3. Second HTTP request for continuing file downloading is formed on web side with header:
- Code: Select all
Range: bytes=8716288-
4. CEF code process this header and fill byte_range_ : net::HttpByteRange in StreamReaderURLLoader with 8716288 as first_byte_position_ and -1 as last_byte_position_
5. CEF code calls Skip() method of my ResourceHandler implementation with bytes_to_skip == 8716288:
- Code: Select all
bool MyResourceHandler::Skip(int64 bytes_to_skip,
int64& bytes_skipped,
CefRefPtr<CefResourceSkipCallback> callback)
{
bytes_skipped = bytes_to_skip;
return true;
}
I set bytes_skipped equal bytes_to_skip.
6. Then DCHECK_GE alerts in this code:
- Code: Select all
// cef\libcef\browser\net_service\stream_reader_url_loader.cc
void StreamReaderURLLoader::OnReaderSkipCompleted(int64_t bytes_skipped) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!byte_range_valid()) {
// Expected content length is unspecified.
HeadersComplete(net::HTTP_OK, -1);
} else if (bytes_skipped == byte_range_.first_byte_position()) {
// We skipped the expected number of bytes.
int64_t expected_content_length = byte_range_.last_byte_position() -
byte_range_.first_byte_position() + 1;
DCHECK_GE(expected_content_length, 0);
HeadersComplete(net::HTTP_OK, expected_content_length);
} else {
RequestComplete(bytes_skipped < 0 ? bytes_skipped : net::ERR_FAILED);
}
}
Because:
expected_content_length == -1 - 8716288 + 1 == -8716288 <-- not greater or equal zero
And this is my question:
Is it a bug in CEF code or what do I doing wrong?