XWiki Platform
  1. XWiki Platform
  2. XWIKI-6106

XWikiServletResponse.setHeader should not addHeader!

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2, 3.0 M3
    • Fix Version/s: 3.0 RC1, 2.7.2
    • Component/s: None
    • Labels:
      None
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      It seems that the method setHeader of XWikiServletResponse, meant to relay to the method setHeader of the underlying response actually relays to addHeader which makes it impossible to redefine a header, for example to set a default client and proxy cache policy or for any other purpose.

      This was found on the xwiki-core-1.5-curriki branch, hence marking 1.5.2 as affected version but it also is in the current trunk, hence marking the current milestone as affected as well.

      The fix is simple:

          public void setHeader(String name, String value)
          {
              this.response.addHeader(name, value);
          }
      

      should become:

          public void setHeader(String name, String value)
          {
              this.response.setHeader(name, value);
          }
      

      This might break some other things that had not noticed that bug but I doubt it since the method addHeader is there and available anyways.

        Activity

        Hide
        Sergiu Dumitriu added a comment -

        Fixed in r35591.

        Show
        Sergiu Dumitriu added a comment - Fixed in r35591.

          People

          • Assignee:
            Sergiu Dumitriu
            Reporter:
            Paul Libbrecht
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Date of First Response: