Project

General

Profile

Actions

Feature #778

closed
WD WD

content-disposition modification

Feature #778: content-disposition modification

Added by Wim Dumon over 15 years ago. Updated about 15 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);

WD Updated by Wim Dumon over 15 years ago Actions #1

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

Done

KD Updated by Koen Deforche about 15 years ago Actions #2

  • Target version set to 3.1.10

KD Updated by Koen Deforche about 15 years ago Actions #3

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom