New issue
Advanced search Search tips

Issue 615528 link

Starred by 5 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Saving a PDF causes a re-download of the file

Reported by alihamze...@gmail.com, May 27 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. Open a PDF
2. Press CMD+S to save it

What is the expected behavior?
Chrome should save the in-memory copy, instead it (attempts) to re-download the PDF.

What went wrong?
When a web page uses a POST request to load a PDF file (see the Fafsa "View Student Aid Report" page) and you try to save it, Chrome fails every time with a "Failed - Network error".

Did this work before? N/A 

Chrome version: 50.0.2661.102  Channel: stable
OS Version: OS X 10.11.4
Flash Version: Shockwave Flash 21.0 r0
 
Components: Internals>Plugins>PDF
Labels: Needs-Feedback
Unable to reproduce the issue on Mac OSX 10.11.5 - 51.0.2704.63

Used the PDF below:
http://buffettscholarships.org/Content/Media/File/Tips_for_downloading_your_Student_Aid_Report_on_the_FAFSA_website.pdf

Can you please upgrade to the latest stable build available and check if you still see this issue ?
And also can you also please provide the PDF file that you have used ?
Hi,
I just updated to 51.0.2704.63 (64-bit) and it still has the same issue. I can't actually provide the PDF because it has a ton of personal information, but here are the steps I used to access it:
1) Go to https://fafsa.ed.gov and Login with FSA ID
2) Click "View or Print your Student Aid Report (SAR)"
3) Click the button at the top that says "View Student Aid Report (PDF)".
4) Press CMD+S and attempt to save the file

I've noticed that after it fails with "Failed - Network error" I can click the little arrow and click "Resume". However, this saves the HTML version of the page as opposed to the PDF.
I created a PHP script that can emulate the behavior. Just add any pdf to the same directory and name it "myPDF.pdf" then run the script. I just copied most of the headers from the Fafsa response but I didn't test which ones affect the saving but I'm assuming it's probably the caching.
test.php
622 bytes View Download
Project Member

Comment 4 by sheriffbot@chromium.org, May 28 2016

Labels: -Needs-Feedback Needs-Review
Owner: pucchakayala@chromium.org
Thank you for providing more feedback. Adding requester "pucchakayala@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

Comment 5 by mef@chromium.org, May 31 2016

Labels: -Needs-Review Needs-Feedback
Looking at the response headers in test.php from comment 3: "Cache-Control:max-age=0, no-cache, no-store" I believe that Chrome is doing the right thing by requesting the resource again.

It doesn't explain the 'Failed - Network Error', and there is not enough info to go on.

Could you collect network details at the time of failure by following these instructions: https://sites.google.com/a/chromium.org/dev/for-testers/providing-network-details 

Comment 6 Deleted

Hi, I attached the net internals log file. As for Chrome doing the right thing, why would it re-request the document if the user wants to save the currently displayed page as is? I understand it shouldn't cache it, so if the user navigates to the page it should re-request it, but saving it with CMD+S should save what the user currently sees on the screen and not whatever the server returns on re-request.
net-internals-log.json
205 KB View Download
Project Member

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

Labels: -Needs-Feedback Needs-Review
Thank you for providing more feedback. Adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
I have exactly the same situation, but it's more of a problem because the SameSite cookie attribute is causing the "Save" action to download the login page (ref  Issue 619603 ).

My server is (as per the PHP default) setting the following headers:

    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Expires: Thu, 19 Nov 1981 08:52:00 GMT

Which is important, as the PDF can contain sensitive information (you need to login to view, and should not be left on disk without the user being aware).

So what headers should I be using to tell Chrome to never cache the response, but still allow the user to save the PDF, without re-requesting it from the server (I should add, the PDF takes a few seconds to generate)?
Cc: pucchakayala@chromium.org
Components: -Internals>Network UI>Browser>Downloads
Labels: -Needs-Review
Owner: ----
Status: WontFix (was: Unconfirmed)
When saving the document, PDF plugin instructs the browser to initiate a download. Since POST is used, browser will only fetch from cache because POST is not safe for retrying. And because cache is disabled (through no-store, no-cache) for this request, there is no cache entry and the request fails.
You can try using GET instead of POST.
In my case I am using a GET request, and it re-requests the PDF from the website... but because of  Issue 619603 , the request returns the HTML for the login page.

Sign in to add a comment