xxfxxf / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 0 forks source link

CEF1: Allow empty |mimeType| argument to GetDownloadHandler #405

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Implement a CefRequestHandler for your CefClient
2. Add to it a GetDownloadHandler method
3. Download a file with it

What is the expected output? What do you see instead?
The method should be called with the correct arguments

What version of the product are you using? On what operating system?
runk r352

Please provide any additional information below.
An error occurs during a check in the previous method "int CEF_CALLBACK 
request_handler_get_download_handler(...)" in file request_handler_cpptoc.cc
The check fails on line 120 " DCHECK(mimeType);" because mimeType is empty.

1/ I believe it should work even if there was no MIME type given by the server 
but in my case I even added a "Content-Type: text/plain" header in my response. 
I think the DCHECK(mimeType) should be removed or that some code should be 
added to allow an empty mime type here.

2/ I dug inside the code base to find the source of this empty string and found 
that the error seems to be located in browser_resource_loader_bridge.cc in 
function RequestProxy::PopulateResponseInfo line 813.
mime_type is populated using a GetMIMEType call on the URLRequest object. That 
method seems to returns the MIME type of the request and not of the response 
(or at least it is was I believe based on my debug experience). I think it is 
not what we want here. We might want a way to extract the MIME type from the 
response (look logical in a "PopulateresponseInfo" method.

I'm working on a patch (this time I think I can do it).

Original issue reported on code.google.com by raynaudq...@gmail.com on 3 Nov 2011 at 2:10

GoogleCodeExporter commented 9 years ago
I do have a patch that seems good for 2/ but I'll try also to patch 1/ just in 
case.

Original comment by raynaudq...@gmail.com on 3 Nov 2011 at 2:48