Closed ebaujard closed 3 years ago
Hi,
the bufferLength
parameter is called so for a reason, it won't contain the response length you set before but the size of the buffer allocated by CEF and provided in the first parameter. This function may be called repeatedly for subsequent chunks of the response data. It's your responsibility to keep track of both the response data length (as simple as fileData.count
) and the offset (as you did with bytesDone
). Basically just copy let chunkSize = min(fileData.count - bytesDone, bufferLength)
bytes to buffer
, then do bytesDone += chunkSize
and return .read(chunkSize)
Hi, Thank you for your prompt answer. I'm migrating from CEF 2924 to CEF 4280, it's disturbing to have the same parameter in these 2 versions with a different purpose.
Hi, I have a problem with CEFResourceHandler in branch cef_4280. The bufferLength parameter is not set correctly for onReadResponseData.
class TestResourceHandler: CEFResourceHandler { var fileData:Data? var bytesDone:Int = 0
}
Did I forget something? Do you have an example of use?
Thanks