New issue
Advanced search Search tips

Issue 616994 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Remote file can not be downloaded by unknown reason

Reported by i.am.spe...@gmail.com, Jun 3 2016

Issue description

Example URL:

Steps to reproduce the problem:
1. Create a PHP script that output file as attachment. I.e. forces the browser to download it instead of showing it in browser. This made by the following header output:

Content-Disposition: attachment; filename=filename="080602_2.pdf"; filename*=utf-8''080602_2.pdf

2. Create a test page with link to this script.
3. Click on the link.

What is the expected behavior?
The file download must be started and file must be saved

What went wrong?
Download cancelled with error "Can not download file XX because of unknown error"

Did this work before? N/A 

Chrome version: 50.0.2661.89  Channel: stable
OS Version: 6.0.1
Flash Version: 

On the test page if you tap and hold on the testlink to show the popup menu and choose "Download link" then the file will be saved successfully.

Desktop version do not have this issue.
 
Components: UI>Browser>Downloads
Cc: asanka@chromium.org
Labels: Needs-Feedback
Please attach a chrome://net-internals log, as described at https://sites.google.com/a/chromium.org/dev/for-testers/providing-network-details
Attached the `net-internals` and `net-export` logs. In the `net-export` log the problematic request is `https://192.168.24.79/files/attachment/62`. This is the script for file downloads. First request - I just followed the link. It cause error in download. Second request - I did tap and hold, and chose the "Download link" in popup menu. It cause successful download.
chrome-net-export-log (1).json
77.3 KB View Download
net-internals-log.json
893 KB View Download
Project Member

Comment 4 by sheriffbot@chromium.org, Jun 8 2016

Labels: -Needs-Feedback Needs-Review
Owner: rsleevi@chromium.org
Thank you for providing more feedback. Adding requester "rsleevi@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -asanka@chromium.org rsleevi@chromium.org
Owner: asanka@chromium.org
Looking.
Cc: asanka@chromium.org
Owner: qin...@chromium.org
Status: Assigned (was: Unconfirmed)
qinmin: Could you take a look? According to the net-internals log the failing download was blocked by DownloadResourceThrottle. Failure to acquire file access permissions?

I thought we moved the permission checks to the ChromeDownloadManagerDelegate or DownloadTargetDeterminer. DownloadResourceThrottle is only consulted for navigation initiated downloads (what happens when a navigation request ends up at a download) and is skipped for explicit downloads since the latter doesn't need throttling.

DownloadResourceThrottle show up the the download is intercepted by Android DownloadManager. There is probably some issues handling the php file with android DownloadManager. However, I cannot repro the issue on my nexus 4 with the following php file:

<?php
$file = 'test.pdf';

if (file_exists($file)) {
    header('Content-Disposition: attachment; filename="test.pdf"');
    header('Content-type: application/pdf');
    header('Content-length: 307798');
    readfile('test.pdf');
    exit;
}
?>

When url of that php is passed to DownloadManager, it is able to download the pdf correctly.
#7: Note that the headers supplied in #0 are malformed. Could you try with the headers used there?

I suspect the issue has something to do with the server that it treats the http request from Android DownloadManager differently from that from Chrome.
#8, from the logs in 3, the actual header is:
Content-Disposition: attachment; filename="080602_2.pdf"; filename*=utf-8''080602_2.pdf

I tried this, and it works for me with Android DownloadManager enabled.
Hi, I created new log for simple static file (not a script) with the same error. Actions are the same: first attempt is simple click on the link, second attempt is tap and hold and choose "Download link". The server response is the same in both cases:

HTTP/1.1 200 OK
Date: Fri, 10 Jun 2016 05:28:43 GMT
Server: Apache/2.4.12 (Win64) OpenSSL/1.0.1l mod_fcgid/2.3.9
Last-Modified: Tue, 24 May 2016 04:32:37 GMT
ETag: "6e-5338f0bee6d66"
Accept-Ranges: bytes
Content-Length: 110
Vary: User-Agent
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/zip


Only requests are different:

First request with error:

GET https://192.168.24.79/test.zip HTTP/1.1
Host: 192.168.24.79
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Save-Data: on
User-Agent: Mozilla/5.0 (Linux; Android 6.0.1; D5803 Build/23.5.A.0.575) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

The second successful request:

GET https://192.168.24.79/test.zip HTTP/1.1
Host: 192.168.24.79
Connection: keep-alive
Referer: https://192.168.24.79/test.php
User-Agent: Mozilla/5.0 (Linux; Android 6.0.1; D5803 Build/23.5.A.0.575) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

____

My phome is Sony Xperia Z3 Compact D5803 with Android 6.0.1
chrome-net-export-log (2).json
49.2 KB View Download
Labels: -Needs-Review
Cleaning up "Needs-Review" label as we are not using this label for triage anymore. Ref bug for this cleanup 684919

Sign in to add a comment