Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-6106

XWikiServletResponse.setHeader should not addHeader!

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.0 RC1, 2.7.2
    • 1.5.2, 3.0 M3
    • None
    • None
    • Unknown

    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.

      Attachments

        Activity

          People

            sdumitriu Sergiu Dumitriu
            polx Paul Libbrecht
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: