svn commit: r1627230 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1627230 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java

jleroux@apache.org
Author: jleroux
Date: Wed Sep 24 06:40:46 2014
New Revision: 1627230

URL: http://svn.apache.org/r1627230
Log:
A patch from Leon for "HttpClient does not support charset name with quotation mark around" https://issues.apache.org/jira/browse/OFBIZ-5787

In RFC2045 (Section 5.1) there is:
"Content-type: text/plain; charset=us-ascii (Plain text)
Content-type: text/plain; charset="us-ascii"
are completely equivalent".

In current revision, if the 'Content-Type' of http response includes the quotation mark around the charset name, HttpClient throws out unsupported encoding exception.

This patch removes quotation marks from charset name extracted from http response header.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java?rev=1627230&r1=1627229&r2=1627230&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java Wed Sep 24 06:40:46 2014
@@ -373,7 +373,7 @@ public class HttpClient {
                     charset = contentType.substring(charsetEqualsLoc + 1);
                 }
 
-                if (charset != null) charset = charset.trim();
+                if (charset != null) charset = charset.trim().replaceAll("\"", "");
                 if (Debug.verboseOn() || debug) Debug.logVerbose("Getting text from HttpClient with charset: " + charset, module);
             }