0

If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold, then my post is out of a temporary file. Undertow FileUtils read it so:

public static String readFile(InputStream file, Charset charSet) { try (BufferedInputStream stream = new BufferedInputStream(file)) { byte[] buff = new byte[1024]; StringBuilder builder = new StringBuilder(); int read; while ((read = stream.read(buff)) != -1) { builder.append(new String(buff, 0, read, charSet)); } return builder.toString(); } catch (IOException e) { throw new RuntimeException(e); } } 

If I understand this good, this code can cut in two slice one UTF-8 non-English character and concat it as two bad character.

támogat��s 

I have a á character and now two bad...

What is the best solution of this problem?

  • Undertow jira ticket
  • Increase treshold size?
  • Leave multipart if it is possible (I think not)

Does somebody have any experience with this?

Thanks a lot. H.

1 Answer 1

0

I made PR and a jira issue:

https://issues.redhat.com/projects/UNDERTOW/issues/UNDERTOW-2552

If multipart form data contains non ascii character and placed on 1024-1025's byte than undertow cut this character into two part and recognize theese as two character.

Bug is after this pull request:

UNDERTOW-2337 Multipart form-data larger than 16KiB is not available through Servlet getParameter API.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.