Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 307847

Summary: Illegal Content-Type computation if combined with custom charset
Product: [RT] Jetty Reporter: Philipe Mulet <philippe_mulet>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: jerome_lanneluc, jetty-inbox, simon_kaegi
Version: unspecified   
Target Milestone: 7.0.2.RC0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philipe Mulet CLA 2010-04-01 06:55:05 EDT
This got discovered in v6.1.15

When setting a custom character encoding on a servlet response (org.mortbay.jetty.Response) for which the content type already contains a semicolon (but not at the end), it ends up producing an illegal content type, which isn't parsed by other libs.

e.g. set charset to UTF-8 on 'multipart/mixed; boundary="frontier"'
does produce: 'multipart/mixed; boundary="frontier" charset=UTF-8'

This seems to come from the following line in org.mortbay.jetty.Response :

_contentType = _contentType+" charset="+QuotedStringTokenizer.quote(_characterEncoding,";= "); 

when checking for presence of a semicolon, it doesn't consider whether the semicolon was in trailing position or not.
Comment 1 Greg Wilkins CLA 2010-04-05 16:44:32 EDT
Fixed for 6.1.23   r5927
Comment 2 Greg Wilkins CLA 2010-04-05 16:58:10 EDT
also fixed for 7.1.0 in r1466
Comment 3 Philipe Mulet CLA 2010-04-09 04:07:05 EDT
Thanks for quick reaction.