Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1680

Part size is incorrectly calculated for multipart request with charset specified on part

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.2.0.Final
    • None
    • None
    • None

      getSize() in javax.servlet.http.Part should return the number of bytes in the part.

      If a multipart request is received with a part having charset=UTF-8 and a body with just a non-ascii letter like "å", then getSize() returns 1, but I would expect 2 as it's encoded as two bytes with the UTF-8 charset.

      The example HTTP request would look something like this:

      POST / HTTP/1.1
      Content-Type: multipart/form-data; boundary=9WZrRBh_HG1r4SRLa2zdF0HF9ADOKF; charset=US-ASCII
      Host: localhost:8000

      --9WZrRBh_HG1r4SRLa2zdF0HF9ADOKF
      Content-Disposition: form-data; name="ex"
      Content-Type: text/plain; charset=UTF-8

      å

              rhn-cservice-bbaranow Bartosz Baranowski
              tim.terlegard Tim Terlegård (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: