Project

General

Profile

Actions

Feature #778

closed

content-disposition modification

Added by Wim Dumon about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
04/05/2011
Due date:
% Done:

100%

Estimated time:

Description

If a file is to be shown in a plugin, you can stress this by adding a Content-Disposition: inline header. If you also add a filename, many browsers show the filename in the title, which is nicer than a random URL.

WResource should get a new method that allows the content-disposition to be set to inline or attachment.

Current situation:

suggestFilename -> Content-Disposition: attachment; filename=..

no suggestFilename -> No Content-Disposition header.

Desired situation:

suggestFilename -> Content-Disposition: [attachment|inline]; filename=...

no suggestFilename -> No Content-Disposition header.

Note: According to rfc2183.txt, you can only suggest a filename when you also set inline or attachment as content-disposition. However, you can specify inline or attachment without a filename. It has not been tested how browsers react on this.

The patch below demonstrates the principle.

diff ---git a/src/Wt/WResource.C b/src/Wt/WResource.C

index ae58eb2..ef110ef 100644

---- a/src/Wt/WResource.C

  • b/src/Wt/WResource.C
    @@ --136,7 +136,7 @@ void WResource::handle(WebRequest webRequest, WebResponse
    // one without specified encoding (Chrome9,
    fileField+= Utils::EncodeHttpHeaderField("filename", suggestedFileName_);
    response.addHeader("Content-Disposition",
  • "attachment;" + fileField);
  • "inline;" + fileField);
    }

handleRequest(request, response);

Actions #1

Updated by Wim Dumon almost 13 years ago

  • Status changed from New to Resolved
  • Assignee changed from Koen Deforche to Wim Dumon
  • % Done changed from 0 to 100

Done

Actions #2

Updated by Koen Deforche almost 13 years ago

  • Target version set to 3.1.10
Actions #3

Updated by Koen Deforche almost 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF