You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/09/24 08:42:40 UTC

svn commit: r1627234 - in /ofbiz/branches/release11.04: ./ framework/base/src/org/ofbiz/base/util/HttpClient.java

Author: jleroux
Date: Wed Sep 24 06:42:40 2014
New Revision: 1627234

URL: http://svn.apache.org/r1627234
Log:
"Applied fix from trunk for revision: 1627230  " 
------------------------------------------------------------------------
r1627230 | jleroux | 2014-09-24 08:40:46 +0200 (mer. 24 sept. 2014) | 11 lignes

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/branches/release11.04/   (props changed)
    ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/HttpClient.java

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1627230

Modified: ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/HttpClient.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/HttpClient.java?rev=1627234&r1=1627233&r2=1627234&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/HttpClient.java (original)
+++ ofbiz/branches/release11.04/framework/base/src/org/ofbiz/base/util/HttpClient.java Wed Sep 24 06:42:40 2014
@@ -362,7 +362,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.logInfo("Getting text from HttpClient with charset: " + charset, module);
             }