Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327601 - Problem with parsing in MultiPartInputStream with escape codes of special characters
Summary: Problem with parsing in MultiPartInputStream with escape codes of special cha...
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 8.0.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.1.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-12 14:56 EDT by Tomaž Vajngerl CLA
Modified: 2010-10-25 04:55 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomaž Vajngerl CLA 2010-10-12 14:56:31 EDT
In cases when the browser (Firefox in my case) uses a character set ISO-8859-1 it replaces all non-supported characters with a escape code in form of { This is also true when uploading files with multipart/form-data POST method. The problem is not in the data itself but in the header of multipart/form-data where the filename can have special characters.

In my case the header was: form-data; name="UploadedFile"; filename="Diplomsko Delo Lektorirano KONČNA.doc"

MultiPartInputStream in parse method on the other hand handles the character ";" as a delimiter character between header elements and in case of "Diplomsko Delo Lektorirano KONČNA.doc" it splits the filename in between where the "special" character is present causing later on an StringIndexOutOfBoundsException.

If the character set is UTF-8 however it work as it is supposed to because the "special" characters are not replaced with a escape code, but still the the parsing code should not fail in such a case.
Comment 1 Greg Wilkins CLA 2010-10-12 21:36:31 EDT
Do you know if there is an RFC that describes this encoding and when it is used?
Comment 2 Greg Wilkins CLA 2010-10-12 21:57:12 EDT
Never mind, I think I can ignore that encoding, just so long as I don't ignore the quotes.

I've changed to using quotedStringTokenenizer instead of StringTokenizer and that appears to have done the trick (for a simple unit test).

This is in r2344 of Jetty-7 and will get merged into Jetty-8

Jan - I'll leave this open and assign to you as I don't think this will be an automatic merge into 8 (plus I think there are other multipart changes for 8 to be done).
Comment 3 Jan Bartel CLA 2010-10-25 04:55:48 EDT
This fix has been merged into jetty-8 from jetty-7 via tag jetty-7-to-jetty-8-base-20101025-1.