jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.86k stars 1.91k forks source link

HttpClient fails to parse Content-Type response header with RFC 2045 charset="utf-8" syntax #1914

Closed fdummert closed 7 years ago

fdummert commented 7 years ago

Hi together,

jetty-client fails to parse a response with following header:

Content-Type: application/soap+xml; charset="utf-8"

According to RFC2045, section 5.1, using quotes for the charset is explicitly allowed, but in following lines, the String "utf-8", including double quotes, is finally being passed to new String(getContent(), encoding) (see this line in HttpContentResponse), resulting in a UnsupportedCharsetException.

Greg has fixed this 15 years ago for the server side (see https://developer.jboss.org/thread/36081), somehow jetty-client has been forgotten. Funny that nobody came across it since then :-)

Best Regards, Florian

sbordet commented 7 years ago

What Jetty version ?

fdummert commented 7 years ago

all, including master. Btw, if this will be fixed, would it be possible to back port it to 9.2.x as well?

sbordet commented 7 years ago

So it's been fixed in 9.2.x onwards, but unlikely we will be making other 9.2.x releases. If you need it for CometD, be aware that CometD can be built against Jetty 9.4.x, see https://docs.cometd.org/current/reference/#_performing_the_build.