I'm trying to implement my own custom scheme handler, but I'm running into problems. The process flow I have right now is:
- Code: Select all
CefSchemeHandlerFactory::Create(browser, frame, "foo", request)
return new FooResourceHandler
FooResourceHandler.Open(request, handle_request, callback)
handle_request = true
return true
FooResourceHandler.GetResponseHeaders(response, response_length, redirect_url)
response.SetStatus(200)
response.SetStatusText("OK")
response.SetMimeType("text/html")
response_length = 179
FooResourceHandler.Read(buffer, 65536 bytes to read, bytes_read, callback)
copied 179 bytes into buffer
bytes_read = 179
return true
FooResourceHandler.Read(buffer, 65357 bytes to read, bytes_read, callback)
bytes_read = 0
return false
FooResourceHandler.Cancel()
Is there something wrong with this flow? Why is Read called twice, even though according to the documentation, the API should know that there's nothing left to read? Why is the operation canceled?
I've verified everything that I'm really setting the values as described above.
In case it's relevant, I'm using the C API, the pseudocode above is translated to the C++ naming scheme.