Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Download file strange error

Post Reply
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

Download file strange error

Post by tad.chen »

A strange error is found When I use TChromium's download function to download file.

In chrmosrDownloadUpdated procedure, every thing is OK in the beginning. The ReceivedBytes of downloadItem become larger and larger, unitl it's the same as TotalBytes. It seams that file download is successful.

But In the end, ReceivedBytes become 0, and both IsInProgress and IsComplete are false. At the same time, the download file disppeared.

I don't know the reason. Could you give me some advice? I use CEF 95.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Download file strange error

Post by salvadordf »

Try to download the same file with the same version of Chromium you use in CEF to check is there's a problem in Chromium or the server.

I just downloaded 2 files from 2 different servers and everything was OK. I used the latest CEF4Delphi version.
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

Re: Download file strange error

Post by tad.chen »

I use cefclient in the same cef version to download file in the same enviroment. It works successfully.

The downloading file error is found in an intranet, and I find another error in it. It'll cause ERR_ABORTED if the browser opens an new url before current url's chrmosrLoadEnd is triggered.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Download file strange error

Post by salvadordf »

Use a different browser in the background to handle normal downloads. BLOB downloads however must be handled by the same browser that the user was using at that moment.

Read the code comments for :
  • ICefDownLoadItem : https://github.com/chromiumembedded/cef/blob/4638/include/capi/cef_download_item_capi.h
  • The download handler that triggers the download events in TChromium : https://github.com/chromiumembedded/cef/blob/4638/include/capi/cef_download_handler_capi.h
  • Chromium error codes : https://chromium.googlesource.com/chromium/src/+/master/net/base/net_error_list.h
cefclient only checks if the download item is complete :
https://github.com/chromiumembedded/cef/blob/d9b764860aa0c1dfad58b123474bc133c4e43d39/tests/cefclient/browser/client_handler.cc#L566

Perhaps the server only allows one connection to download a file and it aborts the other connections if the application tries to create multiple connections.
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

Re: Download file strange error

Post by tad.chen »

But if I change to old CEF library, which is 7X, the downloading file is OK.

The download code of the two browsers is the same, the only difference is the CEF library. CEF 7X can work, but CEF 95 can't.

I think that there is maybe some error during file downloading. How to get error information?
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Download file strange error

Post by salvadordf »

If that's the case then all these issues are probably caused by a change in Chromium's code.

All the error information we have is the list of error codes and the code comments next to each error code.

Check the connection logs in the intranet server too.

Also check the complete list of issues in Chromium. Perhaps this is a known issue :
https://bugs.chromium.org/p/chromium/issues/list

Perhaps you can get more information if you install Wireshark to inspect the HTTP traffic :
https://www.wireshark.org/
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Download file strange error

Post by salvadordf »

I almost forgot. Try using the Network tab in the DevTools.
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

Re: Download file strange error

Post by tad.chen »

Thank you for your information! It seams that it's because of the firewall, which stops file transfering.
Post Reply