Feature Request: smart response.setHeader() method

Bug #506087 reported by Fırat Küçük
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Undecided
Nicolas Leroux
1.1
Fix Committed
Undecided
Nicolas Leroux

Bug Description

Hi,
response.setHeader() method behaves like put method of Hashtable class.
But there can be smart mechanism for some specific HTTP headers. For instance:
"Content-Type" makes duplicate record:

Test-Case:

Controller:
---------------------------------------------------------

  public static void helloText() {
    try {
      response.setHeader("Content-Type", "text/html; charset=utf-8");
      response.out.write("<b>hello</b>".getBytes());
    } catch (Exception e) {
    }
  }

Request:
---------------------------------------------------------
GET /Application/helloText HTTP/1.1
Host: localhost:9000
Connection: close

Response:
---------------------------------------------------------
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: close
Content-Length: 12
Content-Type: text/plain; charset=utf-8
Content-Type: text/html; charset=utf-8
Date: Mon, 11 Jan 2010 19:36:39 GMT
Server: Play! Framework;dev
Set-Cookie: PLAY_ERRORS=; Path=/
Set-Cookie: PLAY_FLASH=; Path=/
Set-Cookie: PLAY_SESSION=067234602de391c9b44852504c609fe78bc5ffbe-%00___ID%3A51dbcbef-cbae-4001-a639-e76f1d6e68df%00; Path=/

known malfunction:
Apache mod_proxy deletes the second Content-Type header. So we can see the files as plain text.

description: updated
Changed in play:
assignee: nobody → Nicolas (nicolas-lunatech)
milestone: none → 1.0.1
Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Thanks for the bug report.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.