|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
[jira] Created: (HTTPCLIENT-884) Charset omitted from UrlEncodedFormEntity Content-Type headerCharset omitted from UrlEncodedFormEntity Content-Type header
------------------------------------------------------------- Key: HTTPCLIENT-884 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-884 Project: HttpComponents HttpClient Issue Type: Bug Components: HttpClient Affects Versions: 4.0 Final Environment: all Reporter: Jared Jacobs UrlEncodedFormEntity sets the Content-Type header to: "application/x-www-form-urlencoded" It should set the header to: "application/x-www-form-urlencoded; charset=" + charset As a result, content can be misinterpreted by the recipient (e.g. if the entity content includes multibyte Unicode characters encoded with the "UTF-8" charset). For a correct example of specifying the charset in the Content-Type header, see StringEntity.java. Here's the fix: public UrlEncodedFormEntity ( final List <? extends NameValuePair> parameters, final String encoding) throws UnsupportedEncodingException { super(URLEncodedUtils.format(parameters, encoding), encoding); - setContentType(URLEncodedUtils.CONTENT_TYPE); + setContentType(URLEncodedUtils.CONTENT_TYPE + HTTP.CHARSET_PARAM + + (encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET)); } public UrlEncodedFormEntity ( final List <? extends NameValuePair> parameters) throws UnsupportedEncodingException { - super(URLEncodedUtils.format(parameters, HTTP.DEFAULT_CONTENT_CHARSET), - HTTP.DEFAULT_CONTENT_CHARSET); - setContentType(URLEncodedUtils.CONTENT_TYPE); + this(parameters, HTTP.DEFAULT_CONTENT_CHARSET); } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
[jira] Updated: (HTTPCLIENT-884) Charset omitted from UrlEncodedFormEntity Content-Type header[ https://issues.apache.org/jira/browse/HTTPCLIENT-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski updated HTTPCLIENT-884: ----------------------------------------- Priority: Minor (was: Major) Fix Version/s: 4.1 Alpha1 4.0.1 > Charset omitted from UrlEncodedFormEntity Content-Type header > ------------------------------------------------------------- > > Key: HTTPCLIENT-884 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-884 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Environment: all > Reporter: Jared Jacobs > Priority: Minor > Fix For: 4.0.1, 4.1 Alpha1 > > Original Estimate: 1h > Remaining Estimate: 1h > > UrlEncodedFormEntity sets the Content-Type header to: > "application/x-www-form-urlencoded" > It should set the header to: > "application/x-www-form-urlencoded; charset=" + charset > As a result, content can be misinterpreted by the recipient (e.g. if the entity content includes multibyte Unicode characters encoded with the "UTF-8" charset). > For a correct example of specifying the charset in the Content-Type header, see StringEntity.java. > Here's the fix: > public UrlEncodedFormEntity ( > final List <? extends NameValuePair> parameters, > final String encoding) throws UnsupportedEncodingException { > super(URLEncodedUtils.format(parameters, encoding), encoding); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + setContentType(URLEncodedUtils.CONTENT_TYPE + HTTP.CHARSET_PARAM + > + (encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET)); > } > public UrlEncodedFormEntity ( > final List <? extends NameValuePair> parameters) throws UnsupportedEncodingException { > - super(URLEncodedUtils.format(parameters, HTTP.DEFAULT_CONTENT_CHARSET), > - HTTP.DEFAULT_CONTENT_CHARSET); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + this(parameters, HTTP.DEFAULT_CONTENT_CHARSET); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
[jira] Resolved: (HTTPCLIENT-884) Charset omitted from UrlEncodedFormEntity Content-Type header[ https://issues.apache.org/jira/browse/HTTPCLIENT-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski resolved HTTPCLIENT-884. ------------------------------------------ Resolution: Fixed Patch checked in to SVN trunk and 4.0.x branch. Please review / re-test Many thanks for submitting the patch, Jared Oleg > Charset omitted from UrlEncodedFormEntity Content-Type header > ------------------------------------------------------------- > > Key: HTTPCLIENT-884 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-884 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Environment: all > Reporter: Jared Jacobs > Priority: Minor > Fix For: 4.0.1, 4.1 Alpha1 > > Original Estimate: 1h > Remaining Estimate: 1h > > UrlEncodedFormEntity sets the Content-Type header to: > "application/x-www-form-urlencoded" > It should set the header to: > "application/x-www-form-urlencoded; charset=" + charset > As a result, content can be misinterpreted by the recipient (e.g. if the entity content includes multibyte Unicode characters encoded with the "UTF-8" charset). > For a correct example of specifying the charset in the Content-Type header, see StringEntity.java. > Here's the fix: > public UrlEncodedFormEntity ( > final List <? extends NameValuePair> parameters, > final String encoding) throws UnsupportedEncodingException { > super(URLEncodedUtils.format(parameters, encoding), encoding); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + setContentType(URLEncodedUtils.CONTENT_TYPE + HTTP.CHARSET_PARAM + > + (encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET)); > } > public UrlEncodedFormEntity ( > final List <? extends NameValuePair> parameters) throws UnsupportedEncodingException { > - super(URLEncodedUtils.format(parameters, HTTP.DEFAULT_CONTENT_CHARSET), > - HTTP.DEFAULT_CONTENT_CHARSET); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + this(parameters, HTTP.DEFAULT_CONTENT_CHARSET); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
[jira] Closed: (HTTPCLIENT-884) Charset omitted from UrlEncodedFormEntity Content-Type header[ https://issues.apache.org/jira/browse/HTTPCLIENT-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jared Jacobs closed HTTPCLIENT-884. ----------------------------------- Fix looks good. I noticed that this issue was omitted from the release notes. Only HTTPCLIENT-885 was mentioned. I believe this issue is more serious than HTTPCLIENT-885 because the library uses the faulty code to send all url-form-encoded entities, whereas the faulty code in HTTPCLIENT-885 is not used internally by the library at all. > Charset omitted from UrlEncodedFormEntity Content-Type header > ------------------------------------------------------------- > > Key: HTTPCLIENT-884 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-884 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Environment: all > Reporter: Jared Jacobs > Priority: Minor > Fix For: 4.0.1, 4.1 Alpha1 > > Original Estimate: 1h > Remaining Estimate: 1h > > UrlEncodedFormEntity sets the Content-Type header to: > "application/x-www-form-urlencoded" > It should set the header to: > "application/x-www-form-urlencoded; charset=" + charset > As a result, content can be misinterpreted by the recipient (e.g. if the entity content includes multibyte Unicode characters encoded with the "UTF-8" charset). > For a correct example of specifying the charset in the Content-Type header, see StringEntity.java. > Here's the fix: > public UrlEncodedFormEntity ( > final List <? extends NameValuePair> parameters, > final String encoding) throws UnsupportedEncodingException { > super(URLEncodedUtils.format(parameters, encoding), encoding); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + setContentType(URLEncodedUtils.CONTENT_TYPE + HTTP.CHARSET_PARAM + > + (encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET)); > } > public UrlEncodedFormEntity ( > final List <? extends NameValuePair> parameters) throws UnsupportedEncodingException { > - super(URLEncodedUtils.format(parameters, HTTP.DEFAULT_CONTENT_CHARSET), > - HTTP.DEFAULT_CONTENT_CHARSET); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + this(parameters, HTTP.DEFAULT_CONTENT_CHARSET); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |