hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1625900 - in /httpcomponents/httpclient-android/branches/4.3.5-android: RELEASE_NOTES.txt src/main/java/org/apache/http/client/params/HttpClientParamConfig.java src/main/java/org/apache/http/impl/client/InternalHttpClient.java
Date Thu, 18 Sep 2014 07:10:08 GMT
Author: olegk
Date: Thu Sep 18 07:10:08 2014
New Revision: 1625900

URL: http://svn.apache.org/r1625900
Log:
HTTPCLIENT-1554: RequestConfig has no effect when using Android HttpRequest classes

Modified:
    httpcomponents/httpclient-android/branches/4.3.5-android/RELEASE_NOTES.txt
    httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/client/params/HttpClientParamConfig.java
    httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/client/InternalHttpClient.java

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/RELEASE_NOTES.txt?rev=1625900&r1=1625899&r2=1625900&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/RELEASE_NOTES.txt Thu Sep 18
07:10:08 2014
@@ -1,6 +1,9 @@
 Changes since 4.3.5
 -------------------
 
+* [HTTPCLIENT-1554] RequestConfig has no effect when using Android HttpRequest classes. 
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-1555] SSL handshake timeout is always zero (infinite).
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/client/params/HttpClientParamConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/client/params/HttpClientParamConfig.java?rev=1625900&r1=1625899&r2=1625900&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/client/params/HttpClientParamConfig.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/client/params/HttpClientParamConfig.java
Thu Sep 18 07:10:08 2014
@@ -27,7 +27,10 @@
 
 package org.apache.http.client.params;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.net.InetAddress;
+import java.util.Map;
 
 import org.apache.http.HttpHost;
 import org.apache.http.client.config.RequestConfig;
@@ -49,6 +52,18 @@ public final class HttpClientParamConfig
 
     @SuppressWarnings("unchecked")
     public static RequestConfig getRequestConfig(final HttpParams params) {
+        if (params == null) {
+            return null;
+        }
+        try {
+            final Field f = params.getClass().getDeclaredField("parameters");
+            f.setAccessible(true);
+            final Map<?, ?> map = (Map<?, ?>) f.get(params);
+            if (map.isEmpty()) {
+                return null;
+            }
+        } catch (Exception ignore) {
+        }
         return RequestConfig.custom()
                 .setSocketTimeout(params.getIntParameter(
                         CoreConnectionPNames.SO_TIMEOUT, 0))

Modified: httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/client/InternalHttpClient.java?rev=1625900&r1=1625899&r2=1625900&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
(original)
+++ httpcomponents/httpclient-android/branches/4.3.5-android/src/main/java/org/apache/http/impl/client/InternalHttpClient.java
Thu Sep 18 07:10:08 2014
@@ -168,13 +168,7 @@ class InternalHttpClient extends Closeab
             }
             if (config == null) {
                 final HttpParams params = request.getParams();
-                if (params instanceof HttpParamsNames) {
-                    if (!((HttpParamsNames) params).getNames().isEmpty()) {
-                        config = HttpClientParamConfig.getRequestConfig(params);
-                    }
-                } else {
-                    config = HttpClientParamConfig.getRequestConfig(params);
-                }
+                config = HttpClientParamConfig.getRequestConfig(params);
             }
             if (config != null) {
                 localcontext.setRequestConfig(config);



Mime
View raw message