I've installed Commerce File and created several audio and video products for sale. When I try to test the sale and download on things, large files are not downloading completely. I'm not getting any kind of error message, but it tells me that my download is complete when it's only downloaded half of the file. The access statistics don't change, so it's not showing that I've downloaded it, but even if I restart the download, I still can't download the whole file.

The specific file I'm talking about is approximately 60MB and is a .wmv file.

Comments

hmartens’s picture

I find the same behaviour even with small files that are downloaded with Internet Explorer. but no problems with other browsers.

hmartens’s picture

Don't know if this will help, but I had similar problem but with any size file on IE 6,7 and 8. I found in my case, it was the way the webserver was
set up. It happens when HTTP compression is enabled on Apache (or IIS) and Internet Explorer 6, 7 and 8 does not handle HTTP compression well and your Apache server is set to compress all files and certain files cannot be more compressed for instance zip files and mp3 and I suppose wmv as well?

So the two ways to get the downloads to work is to either go in to your IE Tools>Internet Options>Advance tab and uncheck "HTTP1.1" and to clear browser cache. But this is not suitable for a Commerce website because you can't expect your clients to go through all of this to download something they bought, so here follows the solution that worked for me:

In .htaccess I added this line right at the bottom: RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1] Then I cleared all cache on Drupal and voila it worked! It must be noted that this does disable all compression on your website...but it works which is important :)

akosipax’s picture

It also doesn't work on Firefox 21 (PC) or on a Chrome (Mac). My file is 1.9GB big and it's a zip file. It stops downloading at around 190 MB. It works with smaller files like a 50MB file.

akosipax’s picture

Priority: Major » Critical

It doesn't download completely with Chrome (PC), Safari (PC), IE 8, Firefox (Mac) and Safari (Mac) as well.

Changing to critical as it seems that it doesn't work with any browser.

Artijangam’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Category: support » bug
Priority: Critical » Major

i have same donwload file issue i can't download my mp3 file of 126 mb completely it has an error occures during the time of downloading .........plz help me

akosipax’s picture

Priority: Major » Critical

What does your error say? Mine just stops downloading and it doesn't give any error in the logs.

cates111’s picture

I have nothing in the error log either. It acts like it's downloaded the whole file but doesn't.

akosipax’s picture

This is what I got so far.

If I download the file directly by visiting the private file link (I didn't buy the product, just downloaded the private file as admin), it won't download completely. I also tested if I can download the same file but in a public directory, and it downloads completely.

Also, if I try downloading the same file in the private directory in my local site which has Apache 2.0 (our dedicated server has Apache 2.2) and it downloads completely.

It seems like an incompatibility with the server configuration + Drupal's private file system. Is anyone experiencing the same thing? Should we move this to core since we can't seem to download huge files from the private directory itself?

I adjusted some php and apache settings to ridiculous values but it still doesn't work. Here are settings I adjusted.

(php)
max_execution_time
max_input_time
memory_limit

(apache)
timeout
MaxRequestsPerChild

hmartens’s picture

I'm busy doing a Drupal performance and optimization course and they're saying that when you doing large file uploads or downloads that it's very difficult to determine the correct settings for max_execution_time and memory_limit. But they say in your etc/php.ini file there should be a whole section in there dealing with if you're doing large file uploads or downloads...so it seems it's definitely a php settings problem.

bojanz’s picture

Category: bug » support
Priority: Critical » Major

Does this happen without commerce_file, using a regular filefield with the files stored in the private filesystem?
I would guess that the answer is yes, meaning that this is not a commerce_file problem.
Can you also try commerce_file 2.x (on a clean drupal install, but same PHP settings)? It uses different headers to download the files, which might help.

My goal for commerce_file 2.x is to support X-Sendfile and X-Accel-Redirect (through https://drupal.org/project/nginx_accel_redirect perhaps?), allowing private files to be downloaded outside of Drupal, removing the need to tinker with PHP configuration.

Reclassifying this as a support request until there's evidence of an actual commerce bug. It doesn't mean I don't want to see this solved & documented ASAP.

bojanz’s picture

Status: Active » Fixed

No reply, I guess that's it for now.

Opened #2064567: Add support for X-Sendfile and X-Accel-Redirect for the X-Sendfile support.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hmartens’s picture

Am I correct in thinking that this problem is something to do with Drupal and php? I've added a 700mb file in sites/default/files and I put the address with the filename straight in the browser and then it downloads the file and doesn't timeout. As soon as you call it from within Drupal, then it normally doesn't get past 80mb...

bojanz’s picture

Yes. As long as the download goes through PHP, it will be limited. That's why we need X-Sendfile support.

hmartens’s picture

Thanks for your feedback. I appreciate it!