Closed Bug 517846 Opened 15 years ago Closed 1 year ago

content-disposition doesn't work for streamed response

Categories

(Core :: Networking: HTTP, defect, P3)

x86
Windows XP
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: askoro, Unassigned)

Details

(Whiteboard: [necko-triaged][necko-priority-new])

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 Trying to force the File Save Dialog through HTTP header in JSP pops-up the Dialog without the file name. Pressing either the OK or the Cancel button want close the dialog. Obviously no data is downloaded. Works perfectly in IE7. The download JSP used is: <%@ page language = "java" %> <%@ page import = "org.apache.commons.io.FileUtils" %> <%@ page import = "java.io.File" %> <% String dirName = request.getParameter("dir"); // relative to the application directory terminated with a forward slash (/) String fileName = request.getParameter("file"); File f = new File(application.getRealPath(dirName+fileName)); long fSize = f.length(); byte[] fContent = FileUtils.readFileToByteArray(f); ServletOutputStream os = response.getOutputStream(); response.setContentType("application/download"); response.setHeader("Content-Length", Long.toString(fSize)); response.setHeader("Content-Disposition", "attachment; filename=\""+fileName+"\";"); os.write(fContent); os.flush(); os.close(); %> Reproducible: Always Steps to Reproduce: 1. Have a page with links to files on the server and call download.jsp?dir="files directory path"&file="files name" 2. On executing the link the File Save Dialog comes up with nothing in it 3. Try closing it with OK/Cancel buttons Actual Results: In valid File Save Dialog Expected Results: File Save Dialog with the name specified in the Content-Disposition header as a suggestion and ability to Open/Save the file. Please note that the file name is enclosed in double quotes even if it has no embedded spaces.
Version: unspecified → 3.5 Branch
Just had a try with a normal (non-modal) window and it works correctly but it still doesn't work from inside a modal window opened with window.showModalDialog(...)
Is this still valid? A bit laborious to test as it requires a JSP set up. It seems JSP is fading away anyways.
QA Whiteboard: qa-not-actionable

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

The severity field is not set for this bug.
:Gijs, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(gijskruitbosch+bugs)

If anything this would need picking up in necko land as that's what handles parsing Content-Disposition headers themselves - but I don't have a setup to run JSP or do "streaming" (unsure what that even means?) responses. So unsure this is even a problem still. Perhaps it would just need to be closed incomplete...

Component: File Handling → Networking: HTTP
Flags: needinfo?(gijskruitbosch+bugs)
Product: Firefox → Core
Version: 3.5 Branch → unspecified

It seems like this is low impact but we'll have the team take a look (though we might just end up closing it - it might actually work now and I'm not sure it's worth the effort of setting up a JSP env).

Severity: -- → S3
Priority: -- → P3
Whiteboard: [necko-triaged][necko-priority-review]
Whiteboard: [necko-triaged][necko-priority-review] → [necko-triaged][necko-priority-new]

Given that we've made a lot of changes to the handling of content-disposition over the last 14 years, and that it's a lot of effort to recreate the testcase, we'll just close it as incomplete.
If anyone finds we still have a problem here, or the actually manage to reproduce, please reopen.

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.