Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2917

WebResponse sets a negative Content-Length when length >2G

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4.5, 1.4.9
    • 1.4.10, 1.5-M1
    • wicket
    • None

    Description

      When using ResourceStreamRequestTarget + FileResourceStream to send a file <2G, the resulting Content-Length in the header is a large negative value. This is due to a cast between a long and an int.

      In wicket, all methods dealing with content-length use longs, but the servlet api HttpServletResponse takes in an int, so WebResponse casts the long into an int which causes the problem.

      The simple work around is to check for >2G lengths and use the addHeader method instead of setContentLength.

      Attached is an extended WebResponse that fixes the problem. This should probably be applied to WebResponse.

      Attachments

        1. webResponse-contentLength-1.4.9.patch
          0.6 kB
          Louis Letourneau

        Activity

          People

            jthomerson Jeremy Thomerson
            lletourn Louis Letourneau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: