From cffb89b13865fe8bfa592ae0567c3a107c169e7e Mon Sep 17 00:00:00 2001 From: Leandro Menezes Date: Fri, 9 Oct 2015 00:42:11 -0300 Subject: [PATCH 01/47] Bearer Authentication Added Bearer Authentication --- .../loopj/android/http/AsyncHttpClient.java | 46 ++++++++++-- .../android/http/BearerAuthSchemeFactory.java | 75 +++++++++++++++++++ .../loopj/android/http/TokenCredentials.java | 28 +++++++ 3 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java create mode 100644 library/src/main/java/com/loopj/android/http/TokenCredentials.java diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java index bada27e07..039224e3d 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java @@ -1,14 +1,13 @@ +package com.loopj.android.http; + /* Android Asynchronous Http Client Copyright (c) 2011 James Smith https://loopj.com - Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,9 +15,8 @@ limitations under the License. */ -package com.loopj.android.http; - import android.content.Context; +import android.media.session.MediaSession; import android.os.Looper; import java.io.IOException; @@ -50,6 +48,7 @@ import cz.msebera.android.httpclient.HttpResponse; import cz.msebera.android.httpclient.HttpResponseInterceptor; import cz.msebera.android.httpclient.HttpVersion; +import cz.msebera.android.httpclient.auth.AuthSchemeRegistry; import cz.msebera.android.httpclient.auth.AuthScope; import cz.msebera.android.httpclient.auth.AuthState; import cz.msebera.android.httpclient.auth.Credentials; @@ -76,6 +75,7 @@ import cz.msebera.android.httpclient.conn.ssl.SSLSocketFactory; import cz.msebera.android.httpclient.entity.HttpEntityWrapper; import cz.msebera.android.httpclient.impl.auth.BasicScheme; +import cz.msebera.android.httpclient.impl.client.BasicCredentialsProvider; import cz.msebera.android.httpclient.impl.client.DefaultHttpClient; import cz.msebera.android.httpclient.impl.conn.tsccm.ThreadSafeClientConnManager; import cz.msebera.android.httpclient.params.BasicHttpParams; @@ -251,6 +251,11 @@ public void process(HttpResponse response, HttpContext context) { httpClient.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { + + AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry(); + authSchemeRegistry.register("Bearer", new BearerAuthSchemeFactory()); + context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry); + AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE); CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute( ClientContext.CREDS_PROVIDER); @@ -259,7 +264,11 @@ public void process(final HttpRequest request, final HttpContext context) throws if (authState.getAuthScheme() == null) { AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort()); Credentials creds = credsProvider.getCredentials(authScope); - if (creds != null) { + if(creds instanceof TokenCredentials) { + authState.setAuthScheme(new BearerAuthSchemeFactory.BearerAuthScheme()); + authState.setCredentials(creds); + } + else if (creds != null) { authState.setAuthScheme(new BasicScheme()); authState.setCredentials(creds); } @@ -791,6 +800,29 @@ public void removeHeader(String header) { clientHeaderMap.remove(header); } + /** + * Sets bearer authentication for the request. Uses AuthScope.ANY. This is the same as + * setBearerAuth('token',AuthScope.ANY, false) + * @param token Bearer Token + */ + public void setBearerAuth(String token) { + setBearerAuth(token, AuthScope.ANY, false); + } + + + /** + * Sets bearer authentication for the request. You should pass in your AuthScope for security. It + * should be like this setBearerAuth("token", new AuthScope("host",port,AuthScope.ANY_REALM), false) + * @param token Bearer Token + * @param scope an AuthScope object + * @param preemptive sets authorization in preemptive manner + */ + public void setBearerAuth(String token, AuthScope scope, boolean preemptive) { + TokenCredentials credentials = new TokenCredentials(token); + setCredentials(scope, credentials); + setAuthenticationPreemptive(preemptive); + } + /** * Sets basic authentication for the request. Uses AuthScope.ANY. This is the same as * setBasicAuth('username','password',AuthScope.ANY) @@ -1635,4 +1667,4 @@ public void consumeContent() throws IOException { super.consumeContent(); } } -} +} \ No newline at end of file diff --git a/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java b/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java new file mode 100644 index 000000000..5db429ebf --- /dev/null +++ b/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java @@ -0,0 +1,75 @@ +package com.loopj.android.http; + +import cz.msebera.android.httpclient.Header; +import cz.msebera.android.httpclient.HttpRequest; +import cz.msebera.android.httpclient.auth.AUTH; +import cz.msebera.android.httpclient.auth.AuthScheme; +import cz.msebera.android.httpclient.auth.AuthSchemeFactory; +import cz.msebera.android.httpclient.auth.AuthenticationException; +import cz.msebera.android.httpclient.auth.ContextAwareAuthScheme; +import cz.msebera.android.httpclient.auth.Credentials; +import cz.msebera.android.httpclient.auth.MalformedChallengeException; +import cz.msebera.android.httpclient.message.BufferedHeader; +import cz.msebera.android.httpclient.params.HttpParams; +import cz.msebera.android.httpclient.protocol.HttpContext; +import cz.msebera.android.httpclient.util.CharArrayBuffer; + +/** + * Created by chase on 08/10/2015. + */ +public class BearerAuthSchemeFactory implements AuthSchemeFactory { + + @Override + public AuthScheme newInstance(HttpParams params) { + return new BearerAuthScheme(); + } + + public static class BearerAuthScheme implements ContextAwareAuthScheme { + private boolean complete = false; + + @Override + public void processChallenge(Header header) throws MalformedChallengeException { + this.complete = true; + } + + @Override + public Header authenticate(Credentials credentials, HttpRequest request) throws AuthenticationException { + return authenticate(credentials, request, null); + } + + @Override + public Header authenticate(Credentials credentials, HttpRequest request, HttpContext httpContext) + throws AuthenticationException { + CharArrayBuffer buffer = new CharArrayBuffer(32); + buffer.append(AUTH.WWW_AUTH_RESP); + buffer.append(": Bearer "); + buffer.append(credentials.getUserPrincipal().getName()); + return new BufferedHeader(buffer); + } + + @Override + public String getSchemeName() { + return "Bearer"; + } + + @Override + public String getParameter(String name) { + return null; + } + + @Override + public String getRealm() { + return null; + } + + @Override + public boolean isConnectionBased() { + return false; + } + + @Override + public boolean isComplete() { + return this.complete; + } + } +} \ No newline at end of file diff --git a/library/src/main/java/com/loopj/android/http/TokenCredentials.java b/library/src/main/java/com/loopj/android/http/TokenCredentials.java new file mode 100644 index 000000000..10549aa45 --- /dev/null +++ b/library/src/main/java/com/loopj/android/http/TokenCredentials.java @@ -0,0 +1,28 @@ +package com.loopj.android.http; + +/** + * Created by chase on 08/10/2015. + */ +import java.security.Principal; + +import cz.msebera.android.httpclient.auth.BasicUserPrincipal; +import cz.msebera.android.httpclient.auth.Credentials; + +public class TokenCredentials implements Credentials { + private Principal userPrincipal; + + public TokenCredentials(String token) { + this.userPrincipal = new BasicUserPrincipal(token); + } + + @Override + public Principal getUserPrincipal() { + return userPrincipal; + } + + @Override + public String getPassword() { + return null; + } + +} From 2a9b4ef7de68196945920de480880a2b7829ba2a Mon Sep 17 00:00:00 2001 From: Xiaowei Zhao Date: Sun, 8 Nov 2015 23:42:48 +0800 Subject: [PATCH 02/47] Make AsyncHttpResponseHandler.ctor more clear --- .../http/AsyncHttpResponseHandler.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java index 609cc21a7..20475601f 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java @@ -117,13 +117,8 @@ public AsyncHttpResponseHandler() { * @param looper The looper to work with */ public AsyncHttpResponseHandler(Looper looper) { - this.looper = looper == null ? Looper.myLooper() : looper; - - // Use asynchronous mode by default. - setUseSynchronousMode(false); - // Do not use the pool's thread to fire callbacks by default. - setUsePoolThread(false); + this(looper == null ? Looper.myLooper() : looper, false); } /** @@ -133,17 +128,24 @@ public AsyncHttpResponseHandler(Looper looper) { * @param usePoolThread Whether to use the pool's thread to fire callbacks */ public AsyncHttpResponseHandler(boolean usePoolThread) { - // Whether to use the pool's thread to fire callbacks. - setUsePoolThread(usePoolThread); - - // When using the pool's thread, there's no sense in having a looper. - if (!getUsePoolThread()) { - // Use the current thread's looper. - this.looper = Looper.myLooper(); + this(usePoolThread ? null : Looper.myLooper(), usePoolThread); + } - // Use asynchronous mode by default. - setUseSynchronousMode(false); + private AsyncHttpResponseHandler(Looper looper, boolean usePoolThread) { + if (!usePoolThread) { + Utils.asserts(looper != null, "use looper thread, must call Looper.prepare() first!"); + this.looper = looper; + // Create a handler on current thread to submit tasks + this.handler = new ResponderHandler(this, looper); + } else { + Utils.asserts(looper == null, "use pool thread, looper should be null!"); + // If pool thread is to be used, there's no point in keeping a reference + // to the looper and handler. + this.looper = null; + this.handler = null; } + + this.usePoolThread = usePoolThread; } @Override From 4a7ac9db33ae4094584499029cb312eba83ee10f Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Tue, 17 Nov 2015 16:49:00 +0100 Subject: [PATCH 03/47] #988 additional changes as of comments in PR --- .../loopj/android/http/AsyncHttpClient.java | 13 ++++++------ .../http/AsyncHttpResponseHandler.java | 2 +- .../android/http/BearerAuthSchemeFactory.java | 20 ++++++++++++++++--- .../loopj/android/http/TokenCredentials.java | 20 ++++++++++++++++--- 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java index 039224e3d..81e89c0f3 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java @@ -16,7 +16,6 @@ */ import android.content.Context; -import android.media.session.MediaSession; import android.os.Looper; import java.io.IOException; @@ -75,7 +74,6 @@ import cz.msebera.android.httpclient.conn.ssl.SSLSocketFactory; import cz.msebera.android.httpclient.entity.HttpEntityWrapper; import cz.msebera.android.httpclient.impl.auth.BasicScheme; -import cz.msebera.android.httpclient.impl.client.BasicCredentialsProvider; import cz.msebera.android.httpclient.impl.client.DefaultHttpClient; import cz.msebera.android.httpclient.impl.conn.tsccm.ThreadSafeClientConnManager; import cz.msebera.android.httpclient.params.BasicHttpParams; @@ -264,11 +262,10 @@ public void process(final HttpRequest request, final HttpContext context) throws if (authState.getAuthScheme() == null) { AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort()); Credentials creds = credsProvider.getCredentials(authScope); - if(creds instanceof TokenCredentials) { + if (creds instanceof TokenCredentials) { authState.setAuthScheme(new BearerAuthSchemeFactory.BearerAuthScheme()); authState.setCredentials(creds); - } - else if (creds != null) { + } else if (creds != null) { authState.setAuthScheme(new BasicScheme()); authState.setCredentials(creds); } @@ -803,6 +800,7 @@ public void removeHeader(String header) { /** * Sets bearer authentication for the request. Uses AuthScope.ANY. This is the same as * setBearerAuth('token',AuthScope.ANY, false) + * * @param token Bearer Token */ public void setBearerAuth(String token) { @@ -813,8 +811,9 @@ public void setBearerAuth(String token) { /** * Sets bearer authentication for the request. You should pass in your AuthScope for security. It * should be like this setBearerAuth("token", new AuthScope("host",port,AuthScope.ANY_REALM), false) - * @param token Bearer Token - * @param scope an AuthScope object + * + * @param token Bearer Token + * @param scope an AuthScope object * @param preemptive sets authorization in preemptive manner */ public void setBearerAuth(String token, AuthScope scope, boolean preemptive) { diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java index 20475601f..88f105a20 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java @@ -78,7 +78,7 @@ * }); * */ -@SuppressWarnings("ALL") +@SuppressWarnings("DesignForExtension") public abstract class AsyncHttpResponseHandler implements ResponseHandlerInterface { public static final String DEFAULT_CHARSET = "UTF-8"; diff --git a/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java b/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java index 5db429ebf..f31065275 100644 --- a/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java +++ b/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java @@ -1,3 +1,20 @@ +/* + Android Asynchronous Http Client + Copyright (c) 2011 James Smith + https://loopj.com + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ package com.loopj.android.http; import cz.msebera.android.httpclient.Header; @@ -14,9 +31,6 @@ import cz.msebera.android.httpclient.protocol.HttpContext; import cz.msebera.android.httpclient.util.CharArrayBuffer; -/** - * Created by chase on 08/10/2015. - */ public class BearerAuthSchemeFactory implements AuthSchemeFactory { @Override diff --git a/library/src/main/java/com/loopj/android/http/TokenCredentials.java b/library/src/main/java/com/loopj/android/http/TokenCredentials.java index 10549aa45..7e8270bbe 100644 --- a/library/src/main/java/com/loopj/android/http/TokenCredentials.java +++ b/library/src/main/java/com/loopj/android/http/TokenCredentials.java @@ -1,8 +1,22 @@ +/* + Android Asynchronous Http Client + Copyright (c) 2011 James Smith + https://loopj.com + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ package com.loopj.android.http; -/** - * Created by chase on 08/10/2015. - */ import java.security.Principal; import cz.msebera.android.httpclient.auth.BasicUserPrincipal; From ff9633e3ac00b8aa864570abc640f4bcabf6a5a5 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Tue, 17 Nov 2015 17:20:55 +0100 Subject: [PATCH 04/47] Distributing proguard.txt in AAR packages --- library/build.gradle | 1 + library/proguard.txt | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 library/proguard.txt diff --git a/library/build.gradle b/library/build.gradle index d463344f6..7a55b32cf 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -7,6 +7,7 @@ android { defaultConfig { minSdkVersion 3 targetSdkVersion 23 + consumerProguardFiles 'proguard.txt' } lintOptions { diff --git a/library/proguard.txt b/library/proguard.txt new file mode 100644 index 000000000..e3ab81252 --- /dev/null +++ b/library/proguard.txt @@ -0,0 +1,2 @@ +-keep class cz.msebera.android.httpclient.** { *; } +-keep class com.loopj.android.http.** { *; } From 9c7b6d41e3b84a5d62dfc914c29536708fc7dcdb Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Tue, 17 Nov 2015 17:50:01 +0100 Subject: [PATCH 05/47] Added HTTP OPTIONS call --- .../loopj/android/http/AsyncHttpClient.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java index 81e89c0f3..6644f5c26 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java @@ -58,6 +58,7 @@ import cz.msebera.android.httpclient.client.RedirectHandler; import cz.msebera.android.httpclient.client.methods.HttpEntityEnclosingRequestBase; import cz.msebera.android.httpclient.client.methods.HttpHead; +import cz.msebera.android.httpclient.client.methods.HttpOptions; import cz.msebera.android.httpclient.client.methods.HttpPatch; import cz.msebera.android.httpclient.client.methods.HttpPost; import cz.msebera.android.httpclient.client.methods.HttpPut; @@ -988,6 +989,24 @@ public void cancelRequestsByTAG(Object TAG, boolean mayInterruptIfRunning) { } // [-] HTTP HEAD + // [+] HTTP OPTIONS + + /** + * Perform a HTTP OPTIONS request, without any parameters. + * + * @param url the URL to send the request to. + * @param responseHandler the response handler instance that should handle the response. + * @return RequestHandle of future request process + */ + public RequestHandle options(String url, ResponseHandlerInterface responseHandler) { + return options(null, url, null, responseHandler); + } + + public RequestHandle options(Context context, String url, RequestParams params, ResponseHandlerInterface responseHandler) { + return sendRequest(httpClient, httpContext, new HttpOptions(getUrlWithQueryString(isUrlEncodingEnabled(), url, params)), null, responseHandler, context); + } + + // [-] HTTP OPTIONS // [+] HTTP GET /** From d03630021b91636f333c40552c5a584d3029a0e2 Mon Sep 17 00:00:00 2001 From: MrTryp Date: Tue, 24 Nov 2015 11:36:15 +0100 Subject: [PATCH 06/47] test test --- test | 1 + 1 file changed, 1 insertion(+) create mode 100644 test diff --git a/test b/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/test @@ -0,0 +1 @@ +test From 61bf8c147898743d0356c47b7c84475707eab185 Mon Sep 17 00:00:00 2001 From: XYG6 Date: Tue, 24 Nov 2015 12:47:51 +0100 Subject: [PATCH 07/47] TLSv1.2 support with TLSv1 fallback Tries to use TLSv1.2 first on the HTTPS connection. If not available, falls back to TLSv1. --- .../android/http/MySSLSocketFactory.java | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 6d88a68d3..538ce4040 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -56,7 +56,17 @@ * certificate validation on every device, use with caution */ public class MySSLSocketFactory extends SSLSocketFactory { - final SSLContext sslContext = SSLContext.getInstance("TLS"); + SSLContext sslContext; + + try { + sslContext = SSLContext.getInstance("TLSv1.2"); + } catch (NoSuchAlgorithmException e) { + // TODO fallback v1.1 if needed + Log_OC.w(TAG, "TLSv1.2 is not supported in this device; falling through TLSv1.0"); + sslContext = SSLContext.getInstance("TLSv1"); + // should be available in any device; see reference of supported protocols in + // http://developer.android.com/reference/javax/net/ssl/SSLSocket.html + } /** * Creates a new SSL Socket Factory with the given KeyStore. @@ -186,13 +196,33 @@ public static DefaultHttpClient getNewHttpClient(KeyStore keyStore) { @Override public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException { - return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); + Socket socket = sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); + enableSecureProtocols(socket); + return socket; } @Override public Socket createSocket() throws IOException { - return sslContext.getSocketFactory().createSocket(); + Socket socket = sslContext.getSocketFactory().createSocket(); + enableSecureProtocols(socket); + return socket; } + + /** + * Activate supported protocols on the socket. + * + * @param socket The socket on which to activate secure protocols. + */ + private void enableSecureProtocols(Socket socket) { + // get supported params + SSLParameters params = sslContext.getSupportedSSLParameters(); + String [] supportedProtocols = params.getProtocols(); + + // activate supported protocols on the socket + Socket socket = sslContext.getSocketFactory().createSocket(); + ((SSLSocket) socket).setEnabledProtocols(supportedProtocols); + //((SSLSocket) socket).setEnabledProtocols(new String[] {"TLSv1.2"} ); + } /** * Makes HttpsURLConnection trusts a set of certificates specified by the KeyStore From 288f5caa5e8edfb736a57e04415aeaba3c6859b5 Mon Sep 17 00:00:00 2001 From: Damien Date: Tue, 24 Nov 2015 13:07:48 +0100 Subject: [PATCH 08/47] Adding some logs --- .../main/java/com/loopj/android/http/MySSLSocketFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 538ce4040..9b62973c6 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -60,9 +60,10 @@ public class MySSLSocketFactory extends SSLSocketFactory { try { sslContext = SSLContext.getInstance("TLSv1.2"); + Log.w("SSLSocketFactory", "TLSv1.2 is supported"); } catch (NoSuchAlgorithmException e) { // TODO fallback v1.1 if needed - Log_OC.w(TAG, "TLSv1.2 is not supported in this device; falling through TLSv1.0"); + Log.w("SSLSocketFactory", "TLSv1.2 is not supported in this device; falling through TLSv1.0"); sslContext = SSLContext.getInstance("TLSv1"); // should be available in any device; see reference of supported protocols in // http://developer.android.com/reference/javax/net/ssl/SSLSocket.html From 86e5a62cfe6b6322741017086edeb3c344e33386 Mon Sep 17 00:00:00 2001 From: damien Date: Tue, 24 Nov 2015 13:15:48 +0100 Subject: [PATCH 09/47] Fix --- .../src/main/java/com/loopj/android/http/MySSLSocketFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 9b62973c6..e67c06f34 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -36,6 +36,7 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; +import android.util.Log; import cz.msebera.android.httpclient.HttpVersion; import cz.msebera.android.httpclient.conn.ClientConnectionManager; From dcbf80f311dea4725ad7fadaf44e7c51699ebf8a Mon Sep 17 00:00:00 2001 From: XYG6 Date: Tue, 24 Nov 2015 13:58:09 +0100 Subject: [PATCH 10/47] FIX - MySSLSocketFactory wrong class structure --- .../android/http/MySSLSocketFactory.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index e67c06f34..8c929fc22 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -59,17 +59,6 @@ public class MySSLSocketFactory extends SSLSocketFactory { SSLContext sslContext; - try { - sslContext = SSLContext.getInstance("TLSv1.2"); - Log.w("SSLSocketFactory", "TLSv1.2 is supported"); - } catch (NoSuchAlgorithmException e) { - // TODO fallback v1.1 if needed - Log.w("SSLSocketFactory", "TLSv1.2 is not supported in this device; falling through TLSv1.0"); - sslContext = SSLContext.getInstance("TLSv1"); - // should be available in any device; see reference of supported protocols in - // http://developer.android.com/reference/javax/net/ssl/SSLSocket.html - } - /** * Creates a new SSL Socket Factory with the given KeyStore. * @@ -81,6 +70,18 @@ public class MySSLSocketFactory extends SSLSocketFactory { */ public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { super(truststore); + + // Define sslContext + try { + sslContext = SSLContext.getInstance("TLSv1.2"); + Log.w("SSLSocketFactory", "TLSv1.2 is supported"); + } catch (NoSuchAlgorithmException e) { + // TODO fallback v1.1 if needed + Log.w("SSLSocketFactory", "TLSv1.2 is not supported in this device; falling through TLSv1.0"); + sslContext = SSLContext.getInstance("TLSv1"); + // should be available in any device; see reference of supported protocols in + // http://developer.android.com/reference/javax/net/ssl/SSLSocket.html + } X509TrustManager tm = new X509TrustManager() { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { From 0209f80757d8ee8932aac5dc95ad7725afd7579c Mon Sep 17 00:00:00 2001 From: XYG6 Date: Tue, 24 Nov 2015 14:37:33 +0100 Subject: [PATCH 11/47] FIX - missing try catch and wrong test min sdk version --- .../loopj/android/http/MySSLSocketFactory.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 8c929fc22..b2c1e90b3 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -34,6 +34,8 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLSocket; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import android.util.Log; @@ -199,9 +201,9 @@ public static DefaultHttpClient getNewHttpClient(KeyStore keyStore) { @Override public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException { - Socket socket = sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); - enableSecureProtocols(socket); - return socket; + Socket localSocket = sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); + enableSecureProtocols(localSocket); + return localSocket; } @Override @@ -222,8 +224,14 @@ private void enableSecureProtocols(Socket socket) { String [] supportedProtocols = params.getProtocols(); // activate supported protocols on the socket - Socket socket = sslContext.getSocketFactory().createSocket(); - ((SSLSocket) socket).setEnabledProtocols(supportedProtocols); + try { + Socket localSocket = sslContext.getSocketFactory().createSocket(); + ((SSLSocket) localSocket).setEnabledProtocols(supportedProtocols); + }catch (Exception e) + { + + } + //((SSLSocket) socket).setEnabledProtocols(new String[] {"TLSv1.2"} ); } From c7ebff882646d128365bb775d91cf33c11eedba6 Mon Sep 17 00:00:00 2001 From: XYG6 Date: Tue, 24 Nov 2015 17:02:22 +0100 Subject: [PATCH 12/47] REFACTORING - compress code --- library/build.gradle | 2 +- .../android/http/MySSLSocketFactory.java | 37 ++++--------------- sample/build.gradle | 2 +- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 7a55b32cf..933f59d80 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion '23.0.1' defaultConfig { - minSdkVersion 3 + minSdkVersion 9 targetSdkVersion 23 consumerProguardFiles 'proguard.txt' } diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index b2c1e90b3..7b73a2eb5 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -59,7 +59,7 @@ * certificate validation on every device, use with caution */ public class MySSLSocketFactory extends SSLSocketFactory { - SSLContext sslContext; + final SSLContext sslContext = SSLContext.getInstance("TLS"); /** * Creates a new SSL Socket Factory with the given KeyStore. @@ -72,18 +72,6 @@ public class MySSLSocketFactory extends SSLSocketFactory { */ public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { super(truststore); - - // Define sslContext - try { - sslContext = SSLContext.getInstance("TLSv1.2"); - Log.w("SSLSocketFactory", "TLSv1.2 is supported"); - } catch (NoSuchAlgorithmException e) { - // TODO fallback v1.1 if needed - Log.w("SSLSocketFactory", "TLSv1.2 is not supported in this device; falling through TLSv1.0"); - sslContext = SSLContext.getInstance("TLSv1"); - // should be available in any device; see reference of supported protocols in - // http://developer.android.com/reference/javax/net/ssl/SSLSocket.html - } X509TrustManager tm = new X509TrustManager() { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { @@ -212,28 +200,17 @@ public Socket createSocket() throws IOException { enableSecureProtocols(socket); return socket; } - + /** * Activate supported protocols on the socket. - * + * * @param socket The socket on which to activate secure protocols. */ private void enableSecureProtocols(Socket socket) { - // get supported params + // set all supported protocols SSLParameters params = sslContext.getSupportedSSLParameters(); - String [] supportedProtocols = params.getProtocols(); - - // activate supported protocols on the socket - try { - Socket localSocket = sslContext.getSocketFactory().createSocket(); - ((SSLSocket) localSocket).setEnabledProtocols(supportedProtocols); - }catch (Exception e) - { - - } - - //((SSLSocket) socket).setEnabledProtocols(new String[] {"TLSv1.2"} ); - } + ((SSLSocket) socket).setEnabledProtocols(params.getProtocols()); + } /** * Makes HttpsURLConnection trusts a set of certificates specified by the KeyStore @@ -242,4 +219,4 @@ public void fixHttpsURLConnection() { HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); } -} +} \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index eb44af0e7..a97f1cf85 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -12,7 +12,7 @@ android { buildToolsVersion '23.0.1' defaultConfig { - minSdkVersion 3 + minSdkVersion 9 targetSdkVersion 23 } From 6721401ebabd01da7f6eb131c9a5871fbe3e1d9d Mon Sep 17 00:00:00 2001 From: XYG6 Date: Tue, 24 Nov 2015 17:08:15 +0100 Subject: [PATCH 13/47] CLEANUP --- .../main/java/com/loopj/android/http/MySSLSocketFactory.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 7b73a2eb5..a0ea08102 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -38,7 +38,6 @@ import javax.net.ssl.SSLSocket; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import android.util.Log; import cz.msebera.android.httpclient.HttpVersion; import cz.msebera.android.httpclient.conn.ClientConnectionManager; @@ -218,5 +217,4 @@ private void enableSecureProtocols(Socket socket) { public void fixHttpsURLConnection() { HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); } - } \ No newline at end of file From cdaf39e8d2d4b8fcd2323471edcf9f47666f0ea6 Mon Sep 17 00:00:00 2001 From: XYG6 Date: Tue, 24 Nov 2015 17:09:54 +0100 Subject: [PATCH 14/47] CLEANUP --- test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test diff --git a/test b/test deleted file mode 100644 index 9daeafb98..000000000 --- a/test +++ /dev/null @@ -1 +0,0 @@ -test From 3ddb081adf934284f9db1adff82af8e8e88d6b43 Mon Sep 17 00:00:00 2001 From: Manan Date: Mon, 8 Feb 2016 18:50:01 +0530 Subject: [PATCH 15/47] Update README changed the incorrect repositories { maven { mavenCentral() } } to repositories { mavenCentral() } --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f56cbc1d6..4b375ec10 100755 --- a/README.md +++ b/README.md @@ -59,10 +59,9 @@ Packaging: JAR or AAR Gradle ```groovy repositories { - maven { - mavenCentral() - } + mavenCentral() } + dependencies { compile 'com.loopj.android:android-async-http:1.4.9' } From effd954e89e8467093fb046d0403e3ba467975f6 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 26 Feb 2016 09:05:53 +0000 Subject: [PATCH 16/47] Set exception cause when re-raising IOException This allows to execute custom logic in AsyncHttpResponseHandler.onFailure for specific errors, e.g. to display a nicer error message to the user when there is a DNS resolution failure, instead of leaking a useless and verbose UnknownHostException in the UI. --- .../main/java/com/loopj/android/http/AsyncHttpRequest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java b/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java index 1d92c9e2d..6113a9032 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java @@ -180,7 +180,7 @@ private void makeRequestWithRetries() throws IOException { // switching between WI-FI and mobile data networks can cause a retry which then results in an UnknownHostException // while the WI-FI is initialising. The retry logic will be invoked here, if this is NOT the first retry // (to assist in genuine cases of unknown host) which seems better than outright failure - cause = new IOException("UnknownHostException exception: " + e.getMessage()); + cause = new IOException("UnknownHostException exception: " + e.getMessage(), e); retry = (executionCount > 0) && retryHandler.retryRequest(e, ++executionCount, context); } catch (NullPointerException e) { // there's a bug in HttpClient 4.0.x that on some occasions causes @@ -203,7 +203,7 @@ private void makeRequestWithRetries() throws IOException { } catch (Exception e) { // catch anything else to ensure failure message is propagated AsyncHttpClient.log.e("AsyncHttpRequest", "Unhandled exception origin cause", e); - cause = new IOException("Unhandled exception: " + e.getMessage()); + cause = new IOException("Unhandled exception: " + e.getMessage(), cause); } // cleaned up to throw IOException From b9809956ca41031f1305cc67a9fc8c8b4632bb5b Mon Sep 17 00:00:00 2001 From: JoDa92 Date: Wed, 27 Apr 2016 08:53:53 +0200 Subject: [PATCH 17/47] Update RequestParams.java Changed ConcurrentHashMap to ConcurrentSkipHashMap for sorting feature --- .../com/loopj/android/http/RequestParams.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/RequestParams.java b/library/src/main/java/com/loopj/android/http/RequestParams.java index 0387b9285..b697f396e 100755 --- a/library/src/main/java/com/loopj/android/http/RequestParams.java +++ b/library/src/main/java/com/loopj/android/http/RequestParams.java @@ -33,7 +33,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentSkipHashMap; import cz.msebera.android.httpclient.HttpEntity; import cz.msebera.android.httpclient.client.entity.UrlEncodedFormEntity; @@ -99,11 +99,11 @@ public class RequestParams implements Serializable { "application/json"; protected final static String LOG_TAG = "RequestParams"; - protected final ConcurrentHashMap urlParams = new ConcurrentHashMap(); - protected final ConcurrentHashMap streamParams = new ConcurrentHashMap(); - protected final ConcurrentHashMap fileParams = new ConcurrentHashMap(); - protected final ConcurrentHashMap> fileArrayParams = new ConcurrentHashMap>(); - protected final ConcurrentHashMap urlParamsWithObjects = new ConcurrentHashMap(); + protected final ConcurrentSkipHashMap urlParams = new ConcurrentSkipHashMap(); + protected final ConcurrentSkipHashMap streamParams = new ConcurrentSkipHashMap(); + protected final ConcurrentSkipHashMap fileParams = new ConcurrentSkipHashMap(); + protected final ConcurrentSkipHashMap> fileArrayParams = new ConcurrentSkipHashMap>(); + protected final ConcurrentSkipHashMap urlParamsWithObjects = new ConcurrentSkipHashMap(); protected boolean isRepeatable; protected boolean forceMultipartEntity = false; protected boolean useJsonStreamer; @@ -425,7 +425,7 @@ public boolean has(String key) { @Override public String toString() { StringBuilder result = new StringBuilder(); - for (ConcurrentHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -434,7 +434,7 @@ public String toString() { result.append(entry.getValue()); } - for (ConcurrentHashMap.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : streamParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -443,7 +443,7 @@ public String toString() { result.append("STREAM"); } - for (ConcurrentHashMap.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : fileParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -452,7 +452,7 @@ public String toString() { result.append("FILE"); } - for (ConcurrentHashMap.Entry> entry : fileArrayParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry> entry : fileArrayParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -530,22 +530,22 @@ private HttpEntity createJsonStreamerEntity(ResponseHandlerInterface progressHan elapsedFieldInJsonStreamer); // Add string params - for (ConcurrentHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add non-string params - for (ConcurrentHashMap.Entry entry : urlParamsWithObjects.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : urlParamsWithObjects.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add file params - for (ConcurrentHashMap.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : fileParams.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add stream params - for (ConcurrentHashMap.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : streamParams.entrySet()) { StreamWrapper stream = entry.getValue(); if (stream.inputStream != null) { entity.addPart(entry.getKey(), @@ -575,7 +575,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle entity.setIsRepeatable(isRepeatable); // Add string params - for (ConcurrentHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { entity.addPartWithCharset(entry.getKey(), entry.getValue(), contentEncoding); } @@ -586,7 +586,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle } // Add stream params - for (ConcurrentHashMap.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : streamParams.entrySet()) { StreamWrapper stream = entry.getValue(); if (stream.inputStream != null) { entity.addPart(entry.getKey(), stream.name, stream.inputStream, @@ -595,13 +595,13 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle } // Add file params - for (ConcurrentHashMap.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : fileParams.entrySet()) { FileWrapper fileWrapper = entry.getValue(); entity.addPart(entry.getKey(), fileWrapper.file, fileWrapper.contentType, fileWrapper.customFileName); } // Add file collection - for (ConcurrentHashMap.Entry> entry : fileArrayParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry> entry : fileArrayParams.entrySet()) { List fileWrapper = entry.getValue(); for (FileWrapper fw : fileWrapper) { entity.addPart(entry.getKey(), fw.file, fw.contentType, fw.customFileName); @@ -614,7 +614,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle protected List getParamsList() { List lparams = new LinkedList(); - for (ConcurrentHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { lparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } From e141b5cb92feadfa040c319858453ea8e4605255 Mon Sep 17 00:00:00 2001 From: JoDa92 Date: Thu, 28 Apr 2016 06:58:52 +0200 Subject: [PATCH 18/47] Update RequestParams.java --- .../com/loopj/android/http/RequestParams.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/RequestParams.java b/library/src/main/java/com/loopj/android/http/RequestParams.java index b697f396e..cade5be69 100755 --- a/library/src/main/java/com/loopj/android/http/RequestParams.java +++ b/library/src/main/java/com/loopj/android/http/RequestParams.java @@ -33,7 +33,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.concurrent.ConcurrentSkipHashMap; +import java.util.concurrent.ConcurrentSkipList; import cz.msebera.android.httpclient.HttpEntity; import cz.msebera.android.httpclient.client.entity.UrlEncodedFormEntity; @@ -99,11 +99,11 @@ public class RequestParams implements Serializable { "application/json"; protected final static String LOG_TAG = "RequestParams"; - protected final ConcurrentSkipHashMap urlParams = new ConcurrentSkipHashMap(); - protected final ConcurrentSkipHashMap streamParams = new ConcurrentSkipHashMap(); - protected final ConcurrentSkipHashMap fileParams = new ConcurrentSkipHashMap(); - protected final ConcurrentSkipHashMap> fileArrayParams = new ConcurrentSkipHashMap>(); - protected final ConcurrentSkipHashMap urlParamsWithObjects = new ConcurrentSkipHashMap(); + protected final ConcurrentSkipList urlParams = new ConcurrentSkipList(); + protected final ConcurrentSkipList streamParams = new ConcurrentSkipList(); + protected final ConcurrentSkipList fileParams = new ConcurrentSkipList(); + protected final ConcurrentSkipList> fileArrayParams = new ConcurrentSkipList>(); + protected final ConcurrentSkipList urlParamsWithObjects = new ConcurrentSkipList(); protected boolean isRepeatable; protected boolean forceMultipartEntity = false; protected boolean useJsonStreamer; @@ -425,7 +425,7 @@ public boolean has(String key) { @Override public String toString() { StringBuilder result = new StringBuilder(); - for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -434,7 +434,7 @@ public String toString() { result.append(entry.getValue()); } - for (ConcurrentSkipHashMap.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : streamParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -443,7 +443,7 @@ public String toString() { result.append("STREAM"); } - for (ConcurrentSkipHashMap.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : fileParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -452,7 +452,7 @@ public String toString() { result.append("FILE"); } - for (ConcurrentSkipHashMap.Entry> entry : fileArrayParams.entrySet()) { + for (ConcurrentSkipList.Entry> entry : fileArrayParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -530,22 +530,22 @@ private HttpEntity createJsonStreamerEntity(ResponseHandlerInterface progressHan elapsedFieldInJsonStreamer); // Add string params - for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add non-string params - for (ConcurrentSkipHashMap.Entry entry : urlParamsWithObjects.entrySet()) { + for (ConcurrentSkipList.Entry entry : urlParamsWithObjects.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add file params - for (ConcurrentSkipHashMap.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : fileParams.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add stream params - for (ConcurrentSkipHashMap.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : streamParams.entrySet()) { StreamWrapper stream = entry.getValue(); if (stream.inputStream != null) { entity.addPart(entry.getKey(), @@ -575,7 +575,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle entity.setIsRepeatable(isRepeatable); // Add string params - for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { entity.addPartWithCharset(entry.getKey(), entry.getValue(), contentEncoding); } @@ -586,7 +586,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle } // Add stream params - for (ConcurrentSkipHashMap.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : streamParams.entrySet()) { StreamWrapper stream = entry.getValue(); if (stream.inputStream != null) { entity.addPart(entry.getKey(), stream.name, stream.inputStream, @@ -595,13 +595,13 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle } // Add file params - for (ConcurrentSkipHashMap.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : fileParams.entrySet()) { FileWrapper fileWrapper = entry.getValue(); entity.addPart(entry.getKey(), fileWrapper.file, fileWrapper.contentType, fileWrapper.customFileName); } // Add file collection - for (ConcurrentSkipHashMap.Entry> entry : fileArrayParams.entrySet()) { + for (ConcurrentSkipList.Entry> entry : fileArrayParams.entrySet()) { List fileWrapper = entry.getValue(); for (FileWrapper fw : fileWrapper) { entity.addPart(entry.getKey(), fw.file, fw.contentType, fw.customFileName); @@ -614,7 +614,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle protected List getParamsList() { List lparams = new LinkedList(); - for (ConcurrentSkipHashMap.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { lparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } From 34a23f8d776d3a563172bada15459757e1df2656 Mon Sep 17 00:00:00 2001 From: BahadirBulduk Date: Tue, 11 Jul 2017 14:30:48 +0300 Subject: [PATCH 19/47] Fixing a security issue which is banned by google play. --- .../com/loopj/android/http/MySSLSocketFactory.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 6d88a68d3..fe5913b08 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -72,9 +72,19 @@ public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, X509TrustManager tm = new X509TrustManager() { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + try { + chain[0].checkValidity(); + } catch (Exception e) { + throw new CertificateException("Certificate not valid or trusted."); + } } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + try { + chain[0].checkValidity(); + } catch (Exception e) { + throw new CertificateException("Certificate not valid or trusted."); + } } public X509Certificate[] getAcceptedIssuers() { From 590a6f25b2bb975e0d3ecbe81f146a8d5776418a Mon Sep 17 00:00:00 2001 From: BahadirBulduk Date: Tue, 11 Jul 2017 14:50:56 +0300 Subject: [PATCH 20/47] Fixing a security issue which is banned by google play. --- library/build.gradle | 4 ++-- .../com/loopj/android/http/PersistentCookieStore.java | 8 ++++---- sample/build.gradle | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 7a55b32cf..943c394ea 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -2,10 +2,10 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion '23.0.1' + buildToolsVersion '23.0.3' defaultConfig { - minSdkVersion 3 + minSdkVersion 9 targetSdkVersion 23 consumerProguardFiles 'proguard.txt' } diff --git a/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java b/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java index b3419ea16..b290746b3 100755 --- a/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java +++ b/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java @@ -97,7 +97,7 @@ public void addCookie(Cookie cookie) { SharedPreferences.Editor prefsWriter = cookiePrefs.edit(); prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", cookies.keySet())); prefsWriter.putString(COOKIE_NAME_PREFIX + name, encodeCookie(new SerializableCookie(cookie))); - prefsWriter.commit(); + prefsWriter.apply(); } @Override @@ -108,7 +108,7 @@ public void clear() { prefsWriter.remove(COOKIE_NAME_PREFIX + name); } prefsWriter.remove(COOKIE_NAME_STORE); - prefsWriter.commit(); + prefsWriter.apply(); // Clear cookies from local store cookies.clear(); @@ -138,7 +138,7 @@ public boolean clearExpired(Date date) { if (clearedAny) { prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", cookies.keySet())); } - prefsWriter.commit(); + prefsWriter.apply(); return clearedAny; } @@ -168,7 +168,7 @@ public void deleteCookie(Cookie cookie) { cookies.remove(name); SharedPreferences.Editor prefsWriter = cookiePrefs.edit(); prefsWriter.remove(COOKIE_NAME_PREFIX + name); - prefsWriter.commit(); + prefsWriter.apply(); } /** diff --git a/sample/build.gradle b/sample/build.gradle index eb44af0e7..7f31e48d9 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -9,10 +9,10 @@ repositories { android { compileSdkVersion 23 - buildToolsVersion '23.0.1' + buildToolsVersion '23.0.3' defaultConfig { - minSdkVersion 3 + minSdkVersion 9 targetSdkVersion 23 } @@ -20,7 +20,7 @@ android { standard { } withLeakCanary { - minSdkVersion 8 + minSdkVersion 9 targetSdkVersion 23 } } From af920ded93c80a417825cace23542958d94ffc87 Mon Sep 17 00:00:00 2001 From: BahadirBulduk Date: Tue, 11 Jul 2017 14:55:35 +0300 Subject: [PATCH 21/47] upgraded travis ci build tools version to 23.0.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c92d7a2cb..040454115 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false jdk: openjdk7 android: components: - - build-tools-23.0.1 + - build-tools-23.0.3 - extra-android-support - extra-android-m2repository - android-23 From 26d135cd2858654ed4a5d65a6370694486751f30 Mon Sep 17 00:00:00 2001 From: BahadirBulduk Date: Tue, 11 Jul 2017 15:26:11 +0300 Subject: [PATCH 22/47] upgraded travis ci build tools version to 23.0.3 --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 040454115..ab2cbbd0d 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,13 @@ sudo: false jdk: openjdk7 android: components: + - platform-tools + - tools - build-tools-23.0.3 - - extra-android-support - - extra-android-m2repository - android-23 + - extra-android-m2repository + - extra-google-m2repository + licenses: - '.+' script: From 9efecabe7dcbd293f09cffa84b2be825958ec840 Mon Sep 17 00:00:00 2001 From: Saeed_rz Date: Sat, 13 Jul 2019 13:20:27 +0430 Subject: [PATCH 23/47] fix issue #998 (#1317) * issue #998: update httpclient to fix unable resolve host issue * fix issue #998 update http client to fix unable resolve host issue * update project gradle version * change ConcurrentSkipList to ConcurrentSkipListMap - ConcurrentSkipList is unavailable in java anymore * remove buildToolsVersion and compileOptions to clear gradle warning * remove buildToolsVersion and compileOptions to clear gradle warning * fix productFlavors config to clear gradle error * change withLeakCanaryCompile to withLeakCanaryImplementation to clear gradle warning --- build.gradle | 7 +++- gradle/wrapper/gradle-wrapper.properties | 4 +- library/build.gradle | 8 +--- .../com/loopj/android/http/RequestParams.java | 39 ++++++++++--------- sample/build.gradle | 17 +++++--- 5 files changed, 40 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index 2a500d66a..9e17ccfe0 100755 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,13 @@ buildscript { repositories { + jcenter() mavenCentral() + google() + } dependencies { - classpath 'com.android.tools.build:gradle:1.3.1' + classpath 'com.android.tools.build:gradle:3.4.1' } } @@ -19,6 +22,8 @@ allprojects { repositories { mavenLocal() mavenCentral() + google() + } tasks.withType(JavaCompile) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3af41f22a..606898b47 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jul 31 10:35:35 CEST 2015 +#Fri Jul 12 02:01:07 PDT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index 943c394ea..f1b1a2d83 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion '23.0.3' defaultConfig { minSdkVersion 9 @@ -17,15 +16,10 @@ android { showAll true disable 'OldTargetApi' } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - } } dependencies { - compile 'cz.msebera.android:httpclient:4.3.6' + compile 'cz.msebera.android:httpclient:4.5.8' } android.libraryVariants.all { variant -> diff --git a/library/src/main/java/com/loopj/android/http/RequestParams.java b/library/src/main/java/com/loopj/android/http/RequestParams.java index cade5be69..911b5d66f 100755 --- a/library/src/main/java/com/loopj/android/http/RequestParams.java +++ b/library/src/main/java/com/loopj/android/http/RequestParams.java @@ -33,7 +33,8 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.concurrent.ConcurrentSkipList; +import java.util.concurrent.ConcurrentSkipListMap; +//import java.util.concurrent.ConcurrentSkipList; import cz.msebera.android.httpclient.HttpEntity; import cz.msebera.android.httpclient.client.entity.UrlEncodedFormEntity; @@ -99,11 +100,11 @@ public class RequestParams implements Serializable { "application/json"; protected final static String LOG_TAG = "RequestParams"; - protected final ConcurrentSkipList urlParams = new ConcurrentSkipList(); - protected final ConcurrentSkipList streamParams = new ConcurrentSkipList(); - protected final ConcurrentSkipList fileParams = new ConcurrentSkipList(); - protected final ConcurrentSkipList> fileArrayParams = new ConcurrentSkipList>(); - protected final ConcurrentSkipList urlParamsWithObjects = new ConcurrentSkipList(); + protected final ConcurrentSkipListMap urlParams = new ConcurrentSkipListMap(); + protected final ConcurrentSkipListMap streamParams = new ConcurrentSkipListMap(); + protected final ConcurrentSkipListMap fileParams = new ConcurrentSkipListMap(); + protected final ConcurrentSkipListMap> fileArrayParams = new ConcurrentSkipListMap>(); + protected final ConcurrentSkipListMap urlParamsWithObjects = new ConcurrentSkipListMap(); protected boolean isRepeatable; protected boolean forceMultipartEntity = false; protected boolean useJsonStreamer; @@ -425,7 +426,7 @@ public boolean has(String key) { @Override public String toString() { StringBuilder result = new StringBuilder(); - for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : urlParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -434,7 +435,7 @@ public String toString() { result.append(entry.getValue()); } - for (ConcurrentSkipList.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : streamParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -443,7 +444,7 @@ public String toString() { result.append("STREAM"); } - for (ConcurrentSkipList.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : fileParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -452,7 +453,7 @@ public String toString() { result.append("FILE"); } - for (ConcurrentSkipList.Entry> entry : fileArrayParams.entrySet()) { + for (ConcurrentSkipListMap.Entry> entry : fileArrayParams.entrySet()) { if (result.length() > 0) result.append("&"); @@ -530,22 +531,22 @@ private HttpEntity createJsonStreamerEntity(ResponseHandlerInterface progressHan elapsedFieldInJsonStreamer); // Add string params - for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : urlParams.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add non-string params - for (ConcurrentSkipList.Entry entry : urlParamsWithObjects.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : urlParamsWithObjects.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add file params - for (ConcurrentSkipList.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : fileParams.entrySet()) { entity.addPart(entry.getKey(), entry.getValue()); } // Add stream params - for (ConcurrentSkipList.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : streamParams.entrySet()) { StreamWrapper stream = entry.getValue(); if (stream.inputStream != null) { entity.addPart(entry.getKey(), @@ -575,7 +576,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle entity.setIsRepeatable(isRepeatable); // Add string params - for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : urlParams.entrySet()) { entity.addPartWithCharset(entry.getKey(), entry.getValue(), contentEncoding); } @@ -586,7 +587,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle } // Add stream params - for (ConcurrentSkipList.Entry entry : streamParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : streamParams.entrySet()) { StreamWrapper stream = entry.getValue(); if (stream.inputStream != null) { entity.addPart(entry.getKey(), stream.name, stream.inputStream, @@ -595,13 +596,13 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle } // Add file params - for (ConcurrentSkipList.Entry entry : fileParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : fileParams.entrySet()) { FileWrapper fileWrapper = entry.getValue(); entity.addPart(entry.getKey(), fileWrapper.file, fileWrapper.contentType, fileWrapper.customFileName); } // Add file collection - for (ConcurrentSkipList.Entry> entry : fileArrayParams.entrySet()) { + for (ConcurrentSkipListMap.Entry> entry : fileArrayParams.entrySet()) { List fileWrapper = entry.getValue(); for (FileWrapper fw : fileWrapper) { entity.addPart(entry.getKey(), fw.file, fw.contentType, fw.customFileName); @@ -614,7 +615,7 @@ private HttpEntity createMultipartEntity(ResponseHandlerInterface progressHandle protected List getParamsList() { List lparams = new LinkedList(); - for (ConcurrentSkipList.Entry entry : urlParams.entrySet()) { + for (ConcurrentSkipListMap.Entry entry : urlParams.entrySet()) { lparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } diff --git a/sample/build.gradle b/sample/build.gradle index 7f31e48d9..c598988bf 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -9,26 +9,31 @@ repositories { android { compileSdkVersion 23 - buildToolsVersion '23.0.3' defaultConfig { minSdkVersion 9 targetSdkVersion 23 } + flavorDimensions "version" productFlavors { standard { + dimension "version" + minSdkVersion 9 + targetSdkVersion 23 + } withLeakCanary { + dimension "version" minSdkVersion 9 targetSdkVersion 23 } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } +// compileOptions { +// sourceCompatibility 'JavaVersion.VERSION_1_7' +// targetCompatibility 'JavaVersion.VERSION_1_7' +// } lintOptions { xmlReport false @@ -49,5 +54,5 @@ dependencies { compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3' compile project(':library') // LeakCanary - withLeakCanaryCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' + withLeakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:1.3.1' } From 5629231a0765040b093115da3bec4cb80d9d57f7 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 13 Jul 2019 10:51:34 +0200 Subject: [PATCH 24/47] Travis CI Java 8 fixup --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab2cbbd0d..ae55dfa01 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: android sudo: false -jdk: openjdk7 +jdk: openjdk8 android: components: - platform-tools @@ -9,7 +9,6 @@ android: - android-23 - extra-android-m2repository - extra-google-m2repository - licenses: - '.+' script: From 7fad56ff284155bf8ce1d1038b1a46513f50b93b Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 13 Jul 2019 10:56:39 +0200 Subject: [PATCH 25/47] Travis CI Android SDK changes --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ae55dfa01..92008c2c9 100755 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ android: components: - platform-tools - tools - - build-tools-23.0.3 - - android-23 + - build-tools-28.0.3 + - android-28 - extra-android-m2repository - extra-google-m2repository licenses: From 6e888937cd4ff2ca861a84d06f6492ee33cae32a Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 13 Jul 2019 11:14:08 +0200 Subject: [PATCH 26/47] Lint fixes for newer SDK --- build.gradle | 2 +- library/build.gradle | 4 ++-- .../android/http/AsyncHttpResponseHandler.java | 5 +++-- sample/build.gradle | 15 +++++---------- .../http/sample/AsyncBackgroundThreadSample.java | 7 ++++--- .../http/sample/CancelRequestHandleSample.java | 10 ++++++---- .../android/http/sample/DirectorySample.java | 6 ++++-- .../com/loopj/android/http/sample/GetSample.java | 4 +++- .../com/loopj/android/http/sample/HeadSample.java | 8 +++++--- .../android/http/sample/Http401AuthSample.java | 2 +- .../android/http/sample/RangeResponseSample.java | 4 +++- .../android/http/sample/Redirect302Sample.java | 4 +++- .../android/http/sample/SampleParentActivity.java | 2 +- .../http/sample/ThreadingTimeoutSample.java | 4 +++- .../sample/services/ExampleIntentService.java | 4 +++- 15 files changed, 47 insertions(+), 34 deletions(-) diff --git a/build.gradle b/build.gradle index 9e17ccfe0..9fe5a37af 100755 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ allprojects { mavenLocal() mavenCentral() google() - + jcenter() } tasks.withType(JavaCompile) { diff --git a/library/build.gradle b/library/build.gradle index f1b1a2d83..45436ae0f 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 23 + compileSdkVersion 28 defaultConfig { minSdkVersion 9 - targetSdkVersion 23 + targetSdkVersion 28 consumerProguardFiles 'proguard.txt' } diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java index 88f105a20..68f60133d 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java @@ -26,6 +26,7 @@ import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.URI; +import java.util.Locale; import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; @@ -241,7 +242,7 @@ public void setCharset(final String charset) { * @param totalSize total size of file */ public void onProgress(long bytesWritten, long totalSize) { - AsyncHttpClient.log.v(LOG_TAG, String.format("Progress %d from %d (%2.0f%%)", bytesWritten, totalSize, (totalSize > 0) ? (bytesWritten * 1.0 / totalSize) * 100 : -1)); + AsyncHttpClient.log.v(LOG_TAG, String.format(Locale.US, "Progress %d from %d (%2.0f%%)", bytesWritten, totalSize, (totalSize > 0) ? (bytesWritten * 1.0 / totalSize) * 100 : -1)); } /** @@ -294,7 +295,7 @@ public void onPostProcessResponse(ResponseHandlerInterface instance, HttpRespons * @param retryNo number of retry */ public void onRetry(int retryNo) { - AsyncHttpClient.log.d(LOG_TAG, String.format("Request retry no. %d", retryNo)); + AsyncHttpClient.log.d(LOG_TAG, String.format(Locale.US, "Request retry no. %d", retryNo)); } public void onCancel() { diff --git a/sample/build.gradle b/sample/build.gradle index c598988bf..23cffecc0 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -8,11 +8,11 @@ repositories { } android { - compileSdkVersion 23 + compileSdkVersion 28 defaultConfig { minSdkVersion 9 - targetSdkVersion 23 + targetSdkVersion 28 } flavorDimensions "version" @@ -20,27 +20,22 @@ android { standard { dimension "version" minSdkVersion 9 - targetSdkVersion 23 + targetSdkVersion 28 } withLeakCanary { dimension "version" minSdkVersion 9 - targetSdkVersion 23 + targetSdkVersion 28 } } -// compileOptions { -// sourceCompatibility 'JavaVersion.VERSION_1_7' -// targetCompatibility 'JavaVersion.VERSION_1_7' -// } - lintOptions { xmlReport false warningsAsErrors true quiet false showAll true - disable 'OldTargetApi', 'UnusedAttribute', 'LongLogTag' + disable 'OldTargetApi', 'UnusedAttribute', 'LongLogTag', 'TrustAllX509TrustManager', 'GoogleAppIndexingWarning', 'Autofill', 'LabelFor', 'SetTextI18n' } packagingOptions { diff --git a/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java b/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java index 62589a3c0..c8a545910 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java @@ -33,6 +33,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; +import java.util.Locale; import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; @@ -109,7 +110,7 @@ public void onStart() { @Override public void onSuccess(int statusCode, Header[] headers, byte[] response) { - Log.d(LOG_TAG, String.format("onSuccess executing on main thread : %B", Looper.myLooper() == Looper.getMainLooper())); + Log.d(LOG_TAG, String.format(Locale.US, "onSuccess executing on main thread : %B", Looper.myLooper() == Looper.getMainLooper())); debugHeaders(LOG_TAG, headers); debugStatusCode(LOG_TAG, statusCode); debugResponse(LOG_TAG, new String(response)); @@ -117,7 +118,7 @@ public void onSuccess(int statusCode, Header[] headers, byte[] response) { @Override public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) { - Log.d(LOG_TAG, String.format("onFailure executing on main thread : %B", Looper.myLooper() == Looper.getMainLooper())); + Log.d(LOG_TAG, String.format(Locale.US, "onFailure executing on main thread : %B", Looper.myLooper() == Looper.getMainLooper())); debugHeaders(LOG_TAG, headers); debugStatusCode(LOG_TAG, statusCode); debugThrowable(LOG_TAG, e); @@ -129,7 +130,7 @@ public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Th @Override public void onRetry(int retryNo) { Toast.makeText(AsyncBackgroundThreadSample.this, - String.format("Request is retried, retry no. %d", retryNo), + String.format(Locale.US, "Request is retried, retry no. %d", retryNo), Toast.LENGTH_SHORT) .show(); } diff --git a/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java b/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java index 5266a50e1..306dcb37d 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java @@ -20,6 +20,8 @@ import android.util.Log; +import java.util.Locale; + import com.loopj.android.http.RequestHandle; public class CancelRequestHandleSample extends ThreadingTimeoutSample { @@ -33,14 +35,14 @@ public int getSampleTitle() { @Override public void onCancelButtonPressed() { - Log.d(LOG_TAG, String.format("Number of handles found: %d", getRequestHandles().size())); + Log.d(LOG_TAG, String.format(Locale.US, "Number of handles found: %d", getRequestHandles().size())); int counter = 0; for (RequestHandle handle : getRequestHandles()) { if (!handle.isCancelled() && !handle.isFinished()) { - Log.d(LOG_TAG, String.format("Cancelling handle %d", counter)); - Log.d(LOG_TAG, String.format("Handle %d cancel", counter) + (handle.cancel(true) ? " succeeded" : " failed")); + Log.d(LOG_TAG, String.format(Locale.US, "Cancelling handle %d", counter)); + Log.d(LOG_TAG, String.format(Locale.US, "Handle %d cancel", counter) + (handle.cancel(true) ? " succeeded" : " failed")); } else { - Log.d(LOG_TAG, String.format("Handle %d already non-cancellable", counter)); + Log.d(LOG_TAG, String.format(Locale.US, "Handle %d already non-cancellable", counter)); } counter++; } diff --git a/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java b/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java index 74c41ca2c..29aed2a67 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java @@ -32,6 +32,8 @@ import java.io.File; +import java.util.Locale; + import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; @@ -71,8 +73,8 @@ public void onClick(View v) { clearOutputs(); if (lastResponseHandler != null) { File toBeDeleted = lastResponseHandler.getTargetFile(); - debugResponse(LOG_TAG, String.format("File was deleted? %b", toBeDeleted.delete())); - debugResponse(LOG_TAG, String.format("Delete file path: %s", toBeDeleted.getAbsolutePath())); + debugResponse(LOG_TAG, String.format(Locale.US, "File was deleted? %b", toBeDeleted.delete())); + debugResponse(LOG_TAG, String.format(Locale.US, "Delete file path: %s", toBeDeleted.getAbsolutePath())); } else { debugThrowable(LOG_TAG, new Error("You have to Run example first")); } diff --git a/sample/src/main/java/com/loopj/android/http/sample/GetSample.java b/sample/src/main/java/com/loopj/android/http/sample/GetSample.java index 02e3880c0..f8bbffc34 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/GetSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/GetSample.java @@ -25,6 +25,8 @@ import com.loopj.android.http.RequestHandle; import com.loopj.android.http.ResponseHandlerInterface; +import java.util.Locale; + import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; @@ -85,7 +87,7 @@ public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Th @Override public void onRetry(int retryNo) { Toast.makeText(GetSample.this, - String.format("Request is retried, retry no. %d", retryNo), + String.format(Locale.US, "Request is retried, retry no. %d", retryNo), Toast.LENGTH_SHORT) .show(); } diff --git a/sample/src/main/java/com/loopj/android/http/sample/HeadSample.java b/sample/src/main/java/com/loopj/android/http/sample/HeadSample.java index 43443970b..d3a6d0dcb 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/HeadSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/HeadSample.java @@ -23,6 +23,8 @@ import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; +import java.util.Locale; + public class HeadSample extends FileSample { private static final String LOG_TAG = "HeadSample"; @@ -34,12 +36,12 @@ public ResponseHandlerInterface getResponseHandler() { public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { debugStatusCode(LOG_TAG, statusCode); debugHeaders(LOG_TAG, headers); - debugResponse(LOG_TAG, String.format("Response of size: %d", responseBody == null ? 0 : responseBody.length)); + debugResponse(LOG_TAG, String.format(Locale.US, "Response of size: %d", responseBody == null ? 0 : responseBody.length)); } @Override public void onProgress(long bytesWritten, long totalSize) { - addView(getColoredView(LIGHTRED, String.format("Progress %d from %d", bytesWritten, totalSize))); + addView(getColoredView(LIGHTRED, String.format(Locale.US, "Progress %d from %d", bytesWritten, totalSize))); } @Override @@ -47,7 +49,7 @@ public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Thr debugStatusCode(LOG_TAG, statusCode); debugHeaders(LOG_TAG, headers); debugThrowable(LOG_TAG, throwable); - debugResponse(LOG_TAG, String.format("Response of size: %d", responseBody == null ? 0 : responseBody.length)); + debugResponse(LOG_TAG, String.format(Locale.US, "Response of size: %d", responseBody == null ? 0 : responseBody.length)); } }; } diff --git a/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java b/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java index 06d32d171..01d71fa6b 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java @@ -188,7 +188,7 @@ public DialogRunnable(String realm) { String prefaceText = preface.getText().toString(); // Substitute placeholders, and re-set the value. - preface.setText(String.format(prefaceText, SECRET_USERNAME, SECRET_PASSWORD)); + preface.setText(String.format(Locale.US, prefaceText, SECRET_USERNAME, SECRET_PASSWORD)); } @Override diff --git a/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java b/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java index aecd8c5ef..d5e4af94a 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java @@ -30,6 +30,8 @@ import java.io.File; import java.io.IOException; +import java.util.Locale; + import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; import cz.msebera.android.httpclient.client.methods.HttpUriRequest; @@ -75,7 +77,7 @@ protected void onDestroy() { // Remove temporary file. if (file != null) { if (!file.delete()) { - Log.e(LOG_TAG, String.format("Couldn't remove temporary file in path: %s", file.getAbsolutePath())); + Log.e(LOG_TAG, String.format(Locale.US, "Couldn't remove temporary file in path: %s", file.getAbsolutePath())); } file = null; } diff --git a/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java b/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java index faf92cbfb..7e1bb6c78 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java @@ -27,6 +27,8 @@ import cz.msebera.android.httpclient.client.HttpClient; import cz.msebera.android.httpclient.impl.client.DefaultHttpClient; +import java.util.Locale; + public class Redirect302Sample extends GetSample { private static final int MENU_ENABLE_REDIRECTS = 10; @@ -89,7 +91,7 @@ public AsyncHttpClient getAsyncHttpClient() { HttpClient client = ahc.getHttpClient(); if (client instanceof DefaultHttpClient) { Toast.makeText(this, - String.format("redirects: %b\nrelative redirects: %b\ncircular redirects: %b", + String.format(Locale.US, "redirects: %b\nrelative redirects: %b\ncircular redirects: %b", enableRedirects, enableRelativeRedirects, enableCircularRedirects), Toast.LENGTH_SHORT ).show(); diff --git a/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java b/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java index ddb3e43a6..2397d494f 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java +++ b/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java @@ -263,7 +263,7 @@ public List
getRequestHeadersList() { String headerName = line.substring(0, equalSignPos).trim(); String headerValue = line.substring(1 + equalSignPos).trim(); - Log.d(LOG_TAG, String.format("Added header: [%s:%s]", headerName, headerValue)); + Log.d(LOG_TAG, String.format(Locale.US, "Added header: [%s:%s]", headerName, headerValue)); headers.add(new BasicHeader(headerName, headerValue)); } catch (Throwable t) { diff --git a/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java b/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java index 815268335..d2c67a6c9 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java @@ -25,6 +25,8 @@ import com.loopj.android.http.RequestHandle; import com.loopj.android.http.ResponseHandlerInterface; +import java.util.Locale; + import cz.msebera.android.httpclient.Header; import cz.msebera.android.httpclient.HttpEntity; @@ -64,7 +66,7 @@ protected synchronized void setStatus(int id, String status) { states.put(id, current == null ? status : current + "," + status); clearOutputs(); for (int i = 0; i < states.size(); i++) { - debugResponse(LOG_TAG, String.format("%d (from %d): %s", states.keyAt(i), getCounter(), states.get(states.keyAt(i)))); + debugResponse(LOG_TAG, String.format(Locale.US, "%d (from %d): %s", states.keyAt(i), getCounter(), states.get(states.keyAt(i)))); } } diff --git a/sample/src/main/java/com/loopj/android/http/sample/services/ExampleIntentService.java b/sample/src/main/java/com/loopj/android/http/sample/services/ExampleIntentService.java index 5742e34e7..53e069ec3 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/services/ExampleIntentService.java +++ b/sample/src/main/java/com/loopj/android/http/sample/services/ExampleIntentService.java @@ -10,6 +10,8 @@ import com.loopj.android.http.sample.IntentServiceSample; import com.loopj.android.http.sample.util.IntentUtil; +import java.util.Locale; + import cz.msebera.android.httpclient.Header; public class ExampleIntentService extends IntentService { @@ -73,7 +75,7 @@ public void onCancel() { @Override public void onRetry(int retryNo) { sendBroadcast(new Intent(IntentServiceSample.ACTION_RETRY)); - Log.d(LOG_TAG, String.format("onRetry: %d", retryNo)); + Log.d(LOG_TAG, String.format(Locale.US, "onRetry: %d", retryNo)); } @Override From d03cc7663902b80d535cd470307258593dc025b9 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 13 Jul 2019 11:50:49 +0200 Subject: [PATCH 27/47] Gradle compatibility fixes --- library/build.gradle | 4 ++-- sample/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 45436ae0f..62d5c94ca 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -19,7 +19,7 @@ android { } dependencies { - compile 'cz.msebera.android:httpclient:4.5.8' + api 'cz.msebera.android:httpclient:4.5.8' } android.libraryVariants.all { variant -> @@ -27,7 +27,7 @@ android.libraryVariants.all { variant -> def task = project.tasks.create "jar${name.capitalize()}", Jar task.dependsOn variant.javaCompile task.from variant.javaCompile.destinationDir - artifacts.add('archives', task); + artifacts.add('archives', task) } apply from: '../maven_push.gradle' diff --git a/sample/build.gradle b/sample/build.gradle index 23cffecc0..f07bda563 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -46,8 +46,8 @@ android { } dependencies { - compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3' - compile project(':library') + api 'com.fasterxml.jackson.core:jackson-databind:2.5.3' + api project(':library') // LeakCanary withLeakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:1.3.1' } From 10ac3b335254b26b7228953514cf55428b0e9be1 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 13 Jul 2019 11:55:27 +0200 Subject: [PATCH 28/47] Updated README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4b375ec10..a1ad1f725 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Asynchronous Http Client for Android ==================================== -[![Build Status](https://travis-ci.org/loopj/android-async-http.png?branch=master)](https://travis-ci.org/loopj/android-async-http) +[![Build Status](https://travis-ci.org/android-async-http/android-async-http.png?branch=master)](https://travis-ci.org/android-async-http/android-async-http) An asynchronous, callback-based Http client for Android built on top of Apache's [HttpClient](https://hc.apache.org/httpcomponents-client-ga/) libraries. @@ -9,14 +9,14 @@ Changelog See what is new in version 1.4.9 released on 19th September 2015 -https://github.com/loopj/android-async-http/blob/1.4.9/CHANGELOG.md +https://github.com/android-async-http/android-async-http/blob/1.4.9/CHANGELOG.md Javadoc ------- Latest Javadoc for 1.4.9 release are available here (also included in Maven repository): -https://loopj.com/android-async-http/doc/ +https://android-async-http.github.io/android-async-http/doc/ Features -------- @@ -35,7 +35,7 @@ Examples -------- For inspiration and testing on device we've provided Sample Application. -See individual samples [here on Github](https://github.com/loopj/android-async-http/tree/1.4.9/sample/src/main/java/com/loopj/android/http/sample) +See individual samples [here on Github](https://github.com/android-async-http/android-async-http/tree/1.4.9/sample/src/main/java/com/loopj/android/http/sample) To run Sample application, simply clone the repository and run this command, to install it on connected device ```java @@ -93,5 +93,5 @@ Documentation, Features and Examples ------------------------------------ Full details and documentation can be found on the project page here: -https://loopj.com/android-async-http/ +https://android-async-http.github.io/android-async-http/ From 86136cdf608c96755e7fb241fdb5df0e6ccc5715 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Thu, 18 Jul 2019 23:43:23 +0200 Subject: [PATCH 29/47] Prepared 1.4.10-SNAPSHOT release, replacing 1.5.0 which is currently being developed in separate branch --- CHANGELOG.md | 5 ++++- README.md | 4 ++-- build.gradle | 2 +- gradle.properties | 4 ++-- sample/src/main/AndroidManifest.xml | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f21beed..ca2ec6608 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # CHANGELOG -## 1.5.0 (future release) +## 1.4.10 + + - Fixed IP/name resolution errors #998 + - Fixed SNI compatibility ## 1.4.9 (released 19. 9. 2015) diff --git a/README.md b/README.md index a1ad1f725..cbee04048 100755 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ https://oss.sonatype.org/content/repositories/snapshots/com/loopj/android/androi Maven URL: https://oss.sonatype.org/content/repositories/snapshots/ GroupId: com.loopj.android ArtifactId: android-async-http -Version: 1.5.0-SNAPSHOT +Version: 1.4.10-SNAPSHOT Packaging: JAR or AAR ``` Gradle @@ -85,7 +85,7 @@ repositories { } } dependencies { - compile 'com.loopj.android:android-async-http:1.5.0-SNAPSHOT' + compile 'com.loopj.android:android-async-http:1.4.10-SNAPSHOT' } ``` diff --git a/build.gradle b/build.gradle index 9fe5a37af..a5ece5534 100755 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ def isReleaseBuild() { allprojects { group = 'com.loopj.android' - version = '1.5.0-SNAPSHOT' + version = '1.4.10-SNAPSHOT' repositories { mavenLocal() diff --git a/gradle.properties b/gradle.properties index 103245293..6b061990e 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=1.5.0-SNAPSHOT -VERSION_CODE=150 +VERSION_NAME=1.4.10-SNAPSHOT +VERSION_CODE=1410 GROUP=com.loopj.android POM_DESCRIPTION=An Asynchronous HTTP Library for Android diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index ba877e103..6c4b7b0bb 100755 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="8" + android:versionName="1.4.10-SNAPSHOT"> From b9592e11929cb8626f839b4669277c9bee0507f9 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Fri, 19 Jul 2019 00:57:04 +0200 Subject: [PATCH 30/47] Applied gradle publish updates to publish 1.4.10-SNAPSHOT to maven snapshots --- build.gradle | 13 ++++--- library/build.gradle | 84 +++++++++++++++++++++++++++++++++++++------- sample/build.gradle | 14 ++------ settings.gradle | 4 +++ 4 files changed, 87 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index a5ece5534..fa33fcf86 100755 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,16 @@ buildscript { repositories { jcenter() - mavenCentral() google() - + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.vanniktech:gradle-android-javadoc-plugin:0.4.0-SNAPSHOT' + classpath 'digital.wup:android-maven-publish:3.6.2' + classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.4" } } @@ -20,16 +23,18 @@ allprojects { version = '1.4.10-SNAPSHOT' repositories { - mavenLocal() - mavenCentral() google() jcenter() + mavenCentral() } tasks.withType(JavaCompile) { options.encoding = "UTF-8" options.compilerArgs << "-Xlint:unchecked" + options.compilerArgs << "-Xlint:deprecation" } } apply plugin: 'android-reporting' +apply plugin: 'com.vanniktech.android.javadoc' +apply plugin: 'com.dorongold.task-tree' diff --git a/library/build.gradle b/library/build.gradle index 62d5c94ca..bdf0596ea 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,4 +1,6 @@ apply plugin: 'com.android.library' +apply plugin: 'digital.wup.android-maven-publish' +apply plugin: 'signing' android { compileSdkVersion 28 @@ -22,20 +24,78 @@ dependencies { api 'cz.msebera.android:httpclient:4.5.8' } -android.libraryVariants.all { variant -> - def name = variant.buildType.name - def task = project.tasks.create "jar${name.capitalize()}", Jar - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - artifacts.add('archives', task) -} - -apply from: '../maven_push.gradle' +project.afterEvaluate { project -> -afterEvaluate { project -> android.libraryVariants.all { variant -> - tasks.androidJavadocs.doFirst { - classpath += files(variant.javaCompile.classpath.files) + def name = variant.buildType.name + def task = project.tasks.create "jar${name.capitalize()}", Jar + task.dependsOn variant.javaCompileProvider.get() + task.from variant.javaCompileProvider.get().destinationDir + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + archiveClassifier = 'sources' + } + + task javadocJar(type: Jar, dependsOn: tasks.findAll { task -> task.name.contains('Javadoc') }) { + archiveClassifier = 'javadoc' + from 'build/docs/javadoc/release/' + } + + publishing { + publications { + maven(MavenPublication) { + artifactId = POM_ARTIFACT_ID + artifact javadocJar + artifact sourcesJar + artifact jarRelease + from components.android + + pom { + name = POM_NAME + description = POM_DESCRIPTION + packaging = POM_PACKAGING + url = POM_URL + + scm { + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION + url = POM_SCM_URL + } + + licenses { + license { + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + distribution = POM_LICENCE_DIST + } + } + } + + pom.name = POM_NAME + pom.description = POM_DESCRIPTION + pom.url = POM_URL + pom.packaging = POM_PACKAGING + } } + repositories { + maven { + def releaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + def snapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots/" + url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl + credentials { + def NexusUsername = project.hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : '' + def NexusPassword = project.hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : '' + username NexusUsername + password NexusPassword + } + } + } + } + + signing { + sign publishing.publications.maven } } + diff --git a/sample/build.gradle b/sample/build.gradle index f07bda563..6f4172494 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -19,14 +19,6 @@ android { productFlavors { standard { dimension "version" - minSdkVersion 9 - targetSdkVersion 28 - - } - withLeakCanary { - dimension "version" - minSdkVersion 9 - targetSdkVersion 28 } } @@ -46,8 +38,6 @@ android { } dependencies { - api 'com.fasterxml.jackson.core:jackson-databind:2.5.3' - api project(':library') - // LeakCanary - withLeakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:1.3.1' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.3' + implementation project(':android-async-http') } diff --git a/settings.gradle b/settings.gradle index 612d9e44e..9a70f607b 100755 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,6 @@ include ':library' include ':sample' + +rootProject.name = 'android-async-http-project' +project(':library').name = 'android-async-http' +project(':sample').name = 'android-async-http-sample' From f7502df2972268b129824a98ef97e2eb78509950 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 20 Jul 2019 07:30:34 +0200 Subject: [PATCH 31/47] Version 1.4.10 release --- .travis.yml | 4 ---- README.md | 8 ++++---- build.gradle | 2 +- gradle.properties | 2 +- sample/src/main/AndroidManifest.xml | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92008c2c9..044942064 100755 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,4 @@ android: licenses: - '.+' script: - # Sonatype bypass - - echo "nexusUsername=dummy" >> library/gradle.properties - - echo "nexusPassword=dummy" >> library/gradle.properties - ./gradlew clean assemble check - - ./gradlew :library:androidJavadocs diff --git a/README.md b/README.md index cbee04048..69ef55bea 100755 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ https://repo1.maven.org/maven2/com/loopj/android/android-async-http/ Maven URL: https://repo1.maven.org/maven2/ GroupId: com.loopj.android ArtifactId: android-async-http -Version: 1.4.9 +Version: 1.4.10 Packaging: JAR or AAR ``` Gradle @@ -63,7 +63,7 @@ repositories { } dependencies { - compile 'com.loopj.android:android-async-http:1.4.9' + compile 'com.loopj.android:android-async-http:1.4.10' } ``` @@ -74,7 +74,7 @@ https://oss.sonatype.org/content/repositories/snapshots/com/loopj/android/androi Maven URL: https://oss.sonatype.org/content/repositories/snapshots/ GroupId: com.loopj.android ArtifactId: android-async-http -Version: 1.4.10-SNAPSHOT +Version: 1.4.11-SNAPSHOT Packaging: JAR or AAR ``` Gradle @@ -85,7 +85,7 @@ repositories { } } dependencies { - compile 'com.loopj.android:android-async-http:1.4.10-SNAPSHOT' + compile 'com.loopj.android:android-async-http:1.4.11-SNAPSHOT' } ``` diff --git a/build.gradle b/build.gradle index fa33fcf86..893672b95 100755 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ def isReleaseBuild() { allprojects { group = 'com.loopj.android' - version = '1.4.10-SNAPSHOT' + version = '1.4.10' repositories { google() diff --git a/gradle.properties b/gradle.properties index 6b061990e..d755ee7c6 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.4.10-SNAPSHOT +VERSION_NAME=1.4.10 VERSION_CODE=1410 GROUP=com.loopj.android diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 6c4b7b0bb..09ed764f8 100755 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ + android:versionName="1.4.10"> From 0132f8b216d2b3479ac3e6bb4926018597a9ae97 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 20 Jul 2019 07:36:06 +0200 Subject: [PATCH 32/47] Travis trusty explicitly, xenial seems to have problems with openjdk --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 044942064..ddc10848e 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: android sudo: false +dist: trusty jdk: openjdk8 android: components: From 9b5d7acc71b6f99f71d7f5c1ec04715486c55683 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 20 Jul 2019 08:18:08 +0200 Subject: [PATCH 33/47] Maven requires developers to be listed in POM, release complete --- library/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/build.gradle b/library/build.gradle index bdf0596ea..ad5aa9044 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -71,6 +71,13 @@ project.afterEvaluate { project -> distribution = POM_LICENCE_DIST } } + + developers { + developer { + id = 'mareksebera' + name = 'Marek Sebera' + } + } } pom.name = POM_NAME From ebc4389b929e5e778bd9d2168adeb4ed9196f8b4 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 20 Jul 2019 17:42:25 +0200 Subject: [PATCH 34/47] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca2ec6608..311e8074f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed IP/name resolution errors #998 - Fixed SNI compatibility + - Upgraded library HttpClient 4.5.8 from 4.3.6 ## 1.4.9 (released 19. 9. 2015) From 7c9fe66f00e1b34b43677baf5e757f7147cec7bf Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 20 Jul 2019 18:42:40 +0200 Subject: [PATCH 35/47] Updated readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 69ef55bea..cef07d2a5 100755 --- a/README.md +++ b/README.md @@ -7,14 +7,14 @@ An asynchronous, callback-based Http client for Android built on top of Apache's Changelog --------- -See what is new in version 1.4.9 released on 19th September 2015 +See what is new in version 1.4.10 released on 20th July 2019 -https://github.com/android-async-http/android-async-http/blob/1.4.9/CHANGELOG.md +https://github.com/android-async-http/android-async-http/blob/1.4.10/CHANGELOG.md Javadoc ------- -Latest Javadoc for 1.4.9 release are available here (also included in Maven repository): +Latest Javadoc for 1.4.10 release are available here (also included in Maven repository): https://android-async-http.github.io/android-async-http/doc/ @@ -35,7 +35,7 @@ Examples -------- For inspiration and testing on device we've provided Sample Application. -See individual samples [here on Github](https://github.com/android-async-http/android-async-http/tree/1.4.9/sample/src/main/java/com/loopj/android/http/sample) +See individual samples [here on Github](https://github.com/android-async-http/android-async-http/tree/1.4.10/sample/src/main/java/com/loopj/android/http/sample) To run Sample application, simply clone the repository and run this command, to install it on connected device ```java From 19ff79cc13b4164360dc5dac1dbb67573d55f48e Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Mon, 22 Jul 2019 12:42:27 +0200 Subject: [PATCH 36/47] Updated links to project, license/notice, copyright links, POM definition in gradle.properties --- NOTICE.txt | 3 +++ gradle.properties | 8 ++++---- .../main/java/com/loopj/android/http/AsyncHttpClient.java | 6 +++--- .../java/com/loopj/android/http/AsyncHttpRequest.java | 2 +- .../com/loopj/android/http/AsyncHttpResponseHandler.java | 2 +- .../loopj/android/http/BaseJsonHttpResponseHandler.java | 2 +- .../com/loopj/android/http/BearerAuthSchemeFactory.java | 2 +- .../com/loopj/android/http/BinaryHttpResponseHandler.java | 2 +- .../loopj/android/http/DataAsyncHttpResponseHandler.java | 2 +- .../loopj/android/http/FileAsyncHttpResponseHandler.java | 2 +- .../src/main/java/com/loopj/android/http/HttpDelete.java | 2 +- library/src/main/java/com/loopj/android/http/HttpGet.java | 2 +- .../com/loopj/android/http/JsonHttpResponseHandler.java | 2 +- .../java/com/loopj/android/http/JsonStreamerEntity.java | 2 +- .../java/com/loopj/android/http/JsonValueInterface.java | 2 +- .../java/com/loopj/android/http/MyRedirectHandler.java | 2 +- .../java/com/loopj/android/http/MySSLSocketFactory.java | 2 +- .../com/loopj/android/http/PersistentCookieStore.java | 2 +- .../PreemptiveAuthorizationHttpRequestInterceptor.java | 2 +- .../android/http/RangeFileAsyncHttpResponseHandler.java | 2 +- .../main/java/com/loopj/android/http/RequestHandle.java | 2 +- .../main/java/com/loopj/android/http/RequestParams.java | 2 +- .../com/loopj/android/http/ResponseHandlerInterface.java | 2 +- .../main/java/com/loopj/android/http/RetryHandler.java | 2 +- .../loopj/android/http/SaxAsyncHttpResponseHandler.java | 2 +- .../java/com/loopj/android/http/SerializableCookie.java | 2 +- .../com/loopj/android/http/SimpleMultipartEntity.java | 2 +- .../main/java/com/loopj/android/http/SyncHttpClient.java | 2 +- .../com/loopj/android/http/TextHttpResponseHandler.java | 2 +- .../java/com/loopj/android/http/TokenCredentials.java | 2 +- library/src/main/java/com/loopj/android/http/Utils.java | 2 +- .../main/java/com/loopj/android/http/package-info.java | 2 +- .../android/http/sample/AsyncBackgroundThreadSample.java | 2 +- .../java/com/loopj/android/http/sample/BinarySample.java | 2 +- .../android/http/sample/CancelAllRequestsSample.java | 2 +- .../android/http/sample/CancelRequestByTagSample.java | 2 +- .../android/http/sample/CancelRequestHandleSample.java | 2 +- .../com/loopj/android/http/sample/CustomCASample.java | 2 +- .../java/com/loopj/android/http/sample/DeleteSample.java | 2 +- .../com/loopj/android/http/sample/DirectorySample.java | 2 +- .../java/com/loopj/android/http/sample/FileSample.java | 2 +- .../java/com/loopj/android/http/sample/GetSample.java | 2 +- .../java/com/loopj/android/http/sample/GzipSample.java | 2 +- .../com/loopj/android/http/sample/Http401AuthSample.java | 2 +- .../java/com/loopj/android/http/sample/JsonSample.java | 2 +- .../com/loopj/android/http/sample/JsonStreamerSample.java | 2 +- .../android/http/sample/PersistentCookiesSample.java | 2 +- .../java/com/loopj/android/http/sample/PostSample.java | 2 +- .../android/http/sample/PrePostProcessingSample.java | 2 +- .../java/com/loopj/android/http/sample/PutSample.java | 2 +- .../loopj/android/http/sample/RangeResponseSample.java | 2 +- .../com/loopj/android/http/sample/Redirect302Sample.java | 2 +- .../com/loopj/android/http/sample/RetryRequestSample.java | 2 +- .../com/loopj/android/http/sample/SampleInterface.java | 2 +- .../loopj/android/http/sample/SampleParentActivity.java | 2 +- .../java/com/loopj/android/http/sample/SaxSample.java | 2 +- .../android/http/sample/SynchronousClientSample.java | 2 +- .../loopj/android/http/sample/ThreadingTimeoutSample.java | 2 +- .../com/loopj/android/http/sample/WaypointsActivity.java | 2 +- .../java/com/loopj/android/http/sample/package-info.java | 2 +- .../loopj/android/http/sample/services/package-info.java | 2 +- .../java/com/loopj/android/http/sample/util/FileUtil.java | 2 +- .../com/loopj/android/http/sample/util/SampleJSON.java | 2 +- .../android/http/sample/util/SecureSocketFactory.java | 2 +- .../com/loopj/android/http/sample/util/package-info.java | 2 +- 65 files changed, 72 insertions(+), 69 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 45deb1012..792ce018f 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -2,5 +2,8 @@ Android Async Http Client library Copyright (c) 2011-2015 James Smith https://loopj.com +Copyright (c) 2015-2019 Marek Sebera +htts://msebera.cz + This product includes software developed by The Apache Software Foundation (https://www.apache.org/). diff --git a/gradle.properties b/gradle.properties index d755ee7c6..eae99249a 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ VERSION_CODE=1410 GROUP=com.loopj.android POM_DESCRIPTION=An Asynchronous HTTP Library for Android -POM_URL=https://loopj.com/android-async-http/ -POM_SCM_URL=https://github.com/loopj/android-async-http -POM_SCM_CONNECTION=scm:git@github.com:loopj/android-async-http.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:loopj/android-async-http.git +POM_URL=https://android-async-http.github.io/android-async-http/ +POM_SCM_URL=https://github.com/android-async-http/android-async-http +POM_SCM_CONNECTION=scm:git@github.com:android-async-http/android-async-http.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:android-async-http/android-async-http.git POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java index 6644f5c26..e470257c5 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java @@ -3,7 +3,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -633,7 +633,7 @@ public void setRedirectHandler(final RedirectHandler customRedirectHandler) { /** * Sets the User-Agent header to be sent with each request. By default, "Android Asynchronous - * Http Client/VERSION (https://loopj.com/android-async-http/)" is used. + * Http Client/VERSION (https://github.com/android-async-http/android-async-http/)" is used. * * @param userAgent the string to use in the User-Agent header. */ @@ -1685,4 +1685,4 @@ public void consumeContent() throws IOException { super.consumeContent(); } } -} \ No newline at end of file +} diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java b/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java index 6113a9032..346cde73e 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpRequest.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java index 68f60133d..096020d9e 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/BaseJsonHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/BaseJsonHttpResponseHandler.java index f9d5f9182..69349f1d0 100755 --- a/library/src/main/java/com/loopj/android/http/BaseJsonHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/BaseJsonHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java b/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java index f31065275..3d17ea294 100644 --- a/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java +++ b/library/src/main/java/com/loopj/android/http/BearerAuthSchemeFactory.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/BinaryHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/BinaryHttpResponseHandler.java index 865fd5efe..2372a94e4 100755 --- a/library/src/main/java/com/loopj/android/http/BinaryHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/BinaryHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/DataAsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/DataAsyncHttpResponseHandler.java index bd5218668..a8d43a189 100755 --- a/library/src/main/java/com/loopj/android/http/DataAsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/DataAsyncHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java index 96bf9aea9..ee0d5b2c5 100755 --- a/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/FileAsyncHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/HttpDelete.java b/library/src/main/java/com/loopj/android/http/HttpDelete.java index 29d74d65d..5a426a76b 100644 --- a/library/src/main/java/com/loopj/android/http/HttpDelete.java +++ b/library/src/main/java/com/loopj/android/http/HttpDelete.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/HttpGet.java b/library/src/main/java/com/loopj/android/http/HttpGet.java index 548a4ae77..7fd882a52 100644 --- a/library/src/main/java/com/loopj/android/http/HttpGet.java +++ b/library/src/main/java/com/loopj/android/http/HttpGet.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/JsonHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/JsonHttpResponseHandler.java index b5bbe0a82..28af16d28 100755 --- a/library/src/main/java/com/loopj/android/http/JsonHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/JsonHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/JsonStreamerEntity.java b/library/src/main/java/com/loopj/android/http/JsonStreamerEntity.java index 56514bc7b..6fbee5040 100755 --- a/library/src/main/java/com/loopj/android/http/JsonStreamerEntity.java +++ b/library/src/main/java/com/loopj/android/http/JsonStreamerEntity.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/JsonValueInterface.java b/library/src/main/java/com/loopj/android/http/JsonValueInterface.java index e7b013622..303d96b22 100644 --- a/library/src/main/java/com/loopj/android/http/JsonValueInterface.java +++ b/library/src/main/java/com/loopj/android/http/JsonValueInterface.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/MyRedirectHandler.java b/library/src/main/java/com/loopj/android/http/MyRedirectHandler.java index 5ee6f6d0f..54f385ede 100644 --- a/library/src/main/java/com/loopj/android/http/MyRedirectHandler.java +++ b/library/src/main/java/com/loopj/android/http/MyRedirectHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2014 Aymon Fournier - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java index 212a81f09..7a2e6f432 100755 --- a/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java +++ b/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java b/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java index b290746b3..8065d4821 100755 --- a/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java +++ b/library/src/main/java/com/loopj/android/http/PersistentCookieStore.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/PreemptiveAuthorizationHttpRequestInterceptor.java b/library/src/main/java/com/loopj/android/http/PreemptiveAuthorizationHttpRequestInterceptor.java index 09a265b69..806c7be25 100644 --- a/library/src/main/java/com/loopj/android/http/PreemptiveAuthorizationHttpRequestInterceptor.java +++ b/library/src/main/java/com/loopj/android/http/PreemptiveAuthorizationHttpRequestInterceptor.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/RangeFileAsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/RangeFileAsyncHttpResponseHandler.java index 2e6e8233d..f327a8caf 100755 --- a/library/src/main/java/com/loopj/android/http/RangeFileAsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/RangeFileAsyncHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/RequestHandle.java b/library/src/main/java/com/loopj/android/http/RequestHandle.java index 6908ae93f..959190e13 100755 --- a/library/src/main/java/com/loopj/android/http/RequestHandle.java +++ b/library/src/main/java/com/loopj/android/http/RequestHandle.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2013 Jason Choy - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/RequestParams.java b/library/src/main/java/com/loopj/android/http/RequestParams.java index 911b5d66f..e594f7909 100755 --- a/library/src/main/java/com/loopj/android/http/RequestParams.java +++ b/library/src/main/java/com/loopj/android/http/RequestParams.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/ResponseHandlerInterface.java b/library/src/main/java/com/loopj/android/http/ResponseHandlerInterface.java index c5936fb43..4040a965b 100755 --- a/library/src/main/java/com/loopj/android/http/ResponseHandlerInterface.java +++ b/library/src/main/java/com/loopj/android/http/ResponseHandlerInterface.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2013 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/RetryHandler.java b/library/src/main/java/com/loopj/android/http/RetryHandler.java index 6f519b9f4..c9e549a2b 100755 --- a/library/src/main/java/com/loopj/android/http/RetryHandler.java +++ b/library/src/main/java/com/loopj/android/http/RetryHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/SaxAsyncHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/SaxAsyncHttpResponseHandler.java index c13428626..8198fb549 100644 --- a/library/src/main/java/com/loopj/android/http/SaxAsyncHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/SaxAsyncHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/SerializableCookie.java b/library/src/main/java/com/loopj/android/http/SerializableCookie.java index 1801b536e..f6b88ffc0 100755 --- a/library/src/main/java/com/loopj/android/http/SerializableCookie.java +++ b/library/src/main/java/com/loopj/android/http/SerializableCookie.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/SimpleMultipartEntity.java b/library/src/main/java/com/loopj/android/http/SimpleMultipartEntity.java index a9c416793..2b4758f70 100755 --- a/library/src/main/java/com/loopj/android/http/SimpleMultipartEntity.java +++ b/library/src/main/java/com/loopj/android/http/SimpleMultipartEntity.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/SyncHttpClient.java b/library/src/main/java/com/loopj/android/http/SyncHttpClient.java index 2d67f806e..dd7d8f532 100755 --- a/library/src/main/java/com/loopj/android/http/SyncHttpClient.java +++ b/library/src/main/java/com/loopj/android/http/SyncHttpClient.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/TextHttpResponseHandler.java b/library/src/main/java/com/loopj/android/http/TextHttpResponseHandler.java index c2ffc7fa9..6b8aa67ed 100755 --- a/library/src/main/java/com/loopj/android/http/TextHttpResponseHandler.java +++ b/library/src/main/java/com/loopj/android/http/TextHttpResponseHandler.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/TokenCredentials.java b/library/src/main/java/com/loopj/android/http/TokenCredentials.java index 7e8270bbe..aa361d395 100644 --- a/library/src/main/java/com/loopj/android/http/TokenCredentials.java +++ b/library/src/main/java/com/loopj/android/http/TokenCredentials.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/Utils.java b/library/src/main/java/com/loopj/android/http/Utils.java index d8311e992..3f56df33f 100644 --- a/library/src/main/java/com/loopj/android/http/Utils.java +++ b/library/src/main/java/com/loopj/android/http/Utils.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/library/src/main/java/com/loopj/android/http/package-info.java b/library/src/main/java/com/loopj/android/http/package-info.java index 7d6224e1e..1e99633ca 100644 --- a/library/src/main/java/com/loopj/android/http/package-info.java +++ b/library/src/main/java/com/loopj/android/http/package-info.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2011 James Smith - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java b/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java index c8a545910..3af0dbea7 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/AsyncBackgroundThreadSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/BinarySample.java b/sample/src/main/java/com/loopj/android/http/sample/BinarySample.java index fea76991d..73d47a5ad 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/BinarySample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/BinarySample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/CancelAllRequestsSample.java b/sample/src/main/java/com/loopj/android/http/sample/CancelAllRequestsSample.java index ac69e69ac..7348e26e4 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/CancelAllRequestsSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/CancelAllRequestsSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/CancelRequestByTagSample.java b/sample/src/main/java/com/loopj/android/http/sample/CancelRequestByTagSample.java index aab1ce744..38f1133bd 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/CancelRequestByTagSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/CancelRequestByTagSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java b/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java index 306dcb37d..e41a1d1be 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/CancelRequestHandleSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/CustomCASample.java b/sample/src/main/java/com/loopj/android/http/sample/CustomCASample.java index faf14ffc2..2a3798ca2 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/CustomCASample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/CustomCASample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/DeleteSample.java b/sample/src/main/java/com/loopj/android/http/sample/DeleteSample.java index 9828894f7..69f443496 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/DeleteSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/DeleteSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java b/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java index 29aed2a67..37b3f986d 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/DirectorySample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/FileSample.java b/sample/src/main/java/com/loopj/android/http/sample/FileSample.java index 08637ea1c..c06f9c480 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/FileSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/FileSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/GetSample.java b/sample/src/main/java/com/loopj/android/http/sample/GetSample.java index f8bbffc34..27b0be0e0 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/GetSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/GetSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/GzipSample.java b/sample/src/main/java/com/loopj/android/http/sample/GzipSample.java index 9025a3000..8da1c9372 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/GzipSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/GzipSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java b/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java index 01d71fa6b..93db38c3c 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/JsonSample.java b/sample/src/main/java/com/loopj/android/http/sample/JsonSample.java index 87442e1ec..59469ea9d 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/JsonSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/JsonSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/JsonStreamerSample.java b/sample/src/main/java/com/loopj/android/http/sample/JsonStreamerSample.java index 91b660f73..4d4d24d03 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/JsonStreamerSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/JsonStreamerSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/PersistentCookiesSample.java b/sample/src/main/java/com/loopj/android/http/sample/PersistentCookiesSample.java index 4be1c222d..69a72e2fb 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/PersistentCookiesSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/PersistentCookiesSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/PostSample.java b/sample/src/main/java/com/loopj/android/http/sample/PostSample.java index 81ce90d93..815961f04 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/PostSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/PostSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/PrePostProcessingSample.java b/sample/src/main/java/com/loopj/android/http/sample/PrePostProcessingSample.java index 04acb7ead..654dab769 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/PrePostProcessingSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/PrePostProcessingSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/PutSample.java b/sample/src/main/java/com/loopj/android/http/sample/PutSample.java index 6be80c5c0..5cab76591 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/PutSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/PutSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java b/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java index d5e4af94a..e7f2e3e84 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/RangeResponseSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java b/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java index 7e1bb6c78..832b6a6eb 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/Redirect302Sample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/RetryRequestSample.java b/sample/src/main/java/com/loopj/android/http/sample/RetryRequestSample.java index 24816064a..64c797c7f 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/RetryRequestSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/RetryRequestSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/SampleInterface.java b/sample/src/main/java/com/loopj/android/http/sample/SampleInterface.java index 3af2fed0d..a259833c7 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/SampleInterface.java +++ b/sample/src/main/java/com/loopj/android/http/sample/SampleInterface.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java b/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java index 2397d494f..126d65bba 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java +++ b/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/SaxSample.java b/sample/src/main/java/com/loopj/android/http/sample/SaxSample.java index 0c5ecebff..be310272c 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/SaxSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/SaxSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/SynchronousClientSample.java b/sample/src/main/java/com/loopj/android/http/sample/SynchronousClientSample.java index 77ffcc60b..59ff04186 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/SynchronousClientSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/SynchronousClientSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java b/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java index d2c67a6c9..f65ba17d8 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java +++ b/sample/src/main/java/com/loopj/android/http/sample/ThreadingTimeoutSample.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/WaypointsActivity.java b/sample/src/main/java/com/loopj/android/http/sample/WaypointsActivity.java index c963a0559..f1dba9d7a 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/WaypointsActivity.java +++ b/sample/src/main/java/com/loopj/android/http/sample/WaypointsActivity.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/package-info.java b/sample/src/main/java/com/loopj/android/http/sample/package-info.java index c22f5a8d1..704f0d47d 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/package-info.java +++ b/sample/src/main/java/com/loopj/android/http/sample/package-info.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/services/package-info.java b/sample/src/main/java/com/loopj/android/http/sample/services/package-info.java index c7c54db2b..df7d33ef2 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/services/package-info.java +++ b/sample/src/main/java/com/loopj/android/http/sample/services/package-info.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/util/FileUtil.java b/sample/src/main/java/com/loopj/android/http/sample/util/FileUtil.java index 18f4334df..faa9b7f5d 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/util/FileUtil.java +++ b/sample/src/main/java/com/loopj/android/http/sample/util/FileUtil.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/util/SampleJSON.java b/sample/src/main/java/com/loopj/android/http/sample/util/SampleJSON.java index e9f109415..60413e5ed 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/util/SampleJSON.java +++ b/sample/src/main/java/com/loopj/android/http/sample/util/SampleJSON.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java b/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java index 1f55730b5..e7020367f 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java +++ b/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Sample Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/sample/src/main/java/com/loopj/android/http/sample/util/package-info.java b/sample/src/main/java/com/loopj/android/http/sample/util/package-info.java index bc0c7263c..7d28904fd 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/util/package-info.java +++ b/sample/src/main/java/com/loopj/android/http/sample/util/package-info.java @@ -1,7 +1,7 @@ /* Android Asynchronous Http Client Copyright (c) 2014 Marek Sebera - https://loopj.com + https://github.com/android-async-http/android-async-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From ca93ab08f63c7adc6743cadb8031b719f4a71e3f Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Sun, 8 Sep 2019 14:47:22 +0430 Subject: [PATCH 37/47] change compile to implementation (#1322) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cef07d2a5..cb1ff5cad 100755 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ repositories { } dependencies { - compile 'com.loopj.android:android-async-http:1.4.10' + implementation 'com.loopj.android:android-async-http:1.4.10' } ``` @@ -85,7 +85,7 @@ repositories { } } dependencies { - compile 'com.loopj.android:android-async-http:1.4.11-SNAPSHOT' + implementation 'com.loopj.android:android-async-http:1.4.11-SNAPSHOT' } ``` From d57c60d6304fd06856bb81acf76e1c7581c286d4 Mon Sep 17 00:00:00 2001 From: Jonathan Leitschuh Date: Fri, 28 Feb 2020 07:20:53 -0500 Subject: [PATCH 38/47] Official Gradle Wrapper Validation Action (#1330) See: https://github.com/gradle/wrapper-validation-action --- .github/workflows/gradle-wrapper-validation.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/gradle-wrapper-validation.yml diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml new file mode 100644 index 000000000..405a2b306 --- /dev/null +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -0,0 +1,10 @@ +name: "Validate Gradle Wrapper" +on: [push, pull_request] + +jobs: + validation: + name: "Validation" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: gradle/wrapper-validation-action@v1 From e14a642befd778d76f0ad8aeb293449acd37cb69 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Sat, 7 Mar 2020 11:41:57 +0100 Subject: [PATCH 39/47] deprecation notice --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index cb1ff5cad..9a03f9d45 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,34 @@ +# This project is no longer maintained, and is currently deprecated and insecure to use + +Since there were no active maintainers for this project for a long time, and issues got stale, +security issues pile up and it's not viable to maintain this project further, given there are +quality replacements, this project is closing down. + +This library has many issues handling modern TLS/SSL security protocols using and problems with validating +chain-of-trust of remote services, it communicates with. It also suffers from high-memory-usage issues, +when handling large upstream or downstream jobs. + +It is not suitable for modern projects, and thus, unless someone takes over the maintenance and invests big time +into making it performance and secure again, it is not recommended to use the library further. + +For issues with using this library or migrating to different one, use appropriate forum, for example +[https://stackoverflow.com/questions/tagged/android-async-http](https://stackoverflow.com/questions/tagged/android-async-http) + +## Use these alternatives, as replacement in your app please: + + - [OkHttp](https://square.github.io/okhttp/) https://square.github.io/okhttp/ + - [Volley](https://developer.android.com/training/volley) https://developer.android.com/training/volley + - [RetroFit](https://square.github.io/retrofit/) https://square.github.io/retrofit/ + +*or don't, i'm not a cop* + +--- +--- +--- +--- + + + Asynchronous Http Client for Android ==================================== [![Build Status](https://travis-ci.org/android-async-http/android-async-http.png?branch=master)](https://travis-ci.org/android-async-http/android-async-http) From 21ce76800520b5678dc61809ab8c8c01e1d90cdc Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Mon, 23 Mar 2020 04:37:53 -0700 Subject: [PATCH 40/47] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a03f9d45..9f8df0429 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# This project is no longer maintained, and is currently deprecated and insecure to use +# This project under develop, and is currently insecure to use Since there were no active maintainers for this project for a long time, and issues got stale, security issues pile up and it's not viable to maintain this project further, given there are From 027625fe1404761748061ccfe882c7cad8101f56 Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Wed, 24 Jun 2020 12:28:46 -0700 Subject: [PATCH 41/47] support Conscrypt (#1340) * add ConscryptSSLProvider to support sni on older android device * fix issue when using conscrypt after create client --- library/build.gradle | 1 + .../loopj/android/http/AsyncHttpClient.java | 8 ++++++++ .../android/http/ConscryptSSLProvider.java | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 library/src/main/java/com/loopj/android/http/ConscryptSSLProvider.java diff --git a/library/build.gradle b/library/build.gradle index ad5aa9044..d63952f0b 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -22,6 +22,7 @@ android { dependencies { api 'cz.msebera.android:httpclient:4.5.8' + compileOnly 'org.conscrypt:conscrypt-android:2.4.0' } project.afterEvaluate { project -> diff --git a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java index e470257c5..f38c4fe10 100755 --- a/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java +++ b/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java @@ -1685,4 +1685,12 @@ public void consumeContent() throws IOException { super.consumeContent(); } } + + /** + * Call this method if your app target android below 4.4 + * This method enable sni in android below 4.4 + */ + public static void useConscryptSSLProvider(){ + ConscryptSSLProvider.install(); + } } diff --git a/library/src/main/java/com/loopj/android/http/ConscryptSSLProvider.java b/library/src/main/java/com/loopj/android/http/ConscryptSSLProvider.java new file mode 100644 index 000000000..67ee69060 --- /dev/null +++ b/library/src/main/java/com/loopj/android/http/ConscryptSSLProvider.java @@ -0,0 +1,18 @@ +package com.loopj.android.http; + +import android.util.Log; + +import org.conscrypt.Conscrypt; + +import java.security.Security; + +public class ConscryptSSLProvider { + public static void install(){ + try { + Security.insertProviderAt(Conscrypt.newProviderBuilder().build(),1); + }catch (NoClassDefFoundError ex){ + Log.e(AsyncHttpClient.LOG_TAG, "java.lang.NoClassDefFoundError: org.conscrypt.Conscrypt, Please add org.conscrypt.Conscrypt to your dependency"); + } + + } +} From d7d858c10d05d27109505ce055a83e30bd52dcad Mon Sep 17 00:00:00 2001 From: Saeedrz Date: Sun, 28 Jun 2020 23:00:36 -0700 Subject: [PATCH 42/47] upgrade gradle version to 6.1.1 --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 893672b95..2eb6cbb57 100755 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:4.0.0' classpath 'com.vanniktech:gradle-android-javadoc-plugin:0.4.0-SNAPSHOT' classpath 'digital.wup:android-maven-publish:3.6.2' classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.4" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 606898b47..7bfd9f1e4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jul 12 02:01:07 PDT 2019 +#Sun Jun 28 22:59:06 PDT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip From 819c0e0cf76163223eb1999c998c28e8b29802ee Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Sun, 28 Jun 2020 23:21:16 -0700 Subject: [PATCH 43/47] Fix gradle warning (#1341) * remove unused if, sdk set always greater than 4 * Unnecessary; SDK_INT is always >= 9 * Use SDK_INT to easily get sdk as an integer * Unnecessary; SDK_INT is always >= 9 --- .../com/loopj/android/http/LogHandler.java | 6 +---- .../http/sample/SampleParentActivity.java | 2 +- .../http/sample/util/SecureSocketFactory.java | 9 +++----- .../http/sample/SampleApplication.java | 22 +++++++++---------- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/library/src/main/java/com/loopj/android/http/LogHandler.java b/library/src/main/java/com/loopj/android/http/LogHandler.java index dc7ffd2bc..2b7080a15 100644 --- a/library/src/main/java/com/loopj/android/http/LogHandler.java +++ b/library/src/main/java/com/loopj/android/http/LogHandler.java @@ -54,11 +54,7 @@ public void logWithThrowable(int logLevel, String tag, String msg, Throwable t) Log.d(tag, msg, t); break; case WTF: - if (Integer.valueOf(Build.VERSION.SDK) > 8) { - checkedWtf(tag, msg, t); - } else { - Log.e(tag, msg, t); - } + checkedWtf(tag, msg, t); break; case INFO: Log.i(tag, msg, t); diff --git a/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java b/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java index 126d65bba..165b2baf8 100755 --- a/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java +++ b/sample/src/main/java/com/loopj/android/http/sample/SampleParentActivity.java @@ -394,7 +394,7 @@ public void setAsyncHttpClient(AsyncHttpClient client) { @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setHomeAsUpEnabled() { - if (Integer.valueOf(Build.VERSION.SDK) >= 11) { + if (Build.VERSION.SDK_INT >= 11) { if (getActionBar() != null) getActionBar().setDisplayHomeAsUpEnabled(true); } diff --git a/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java b/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java index e7020367f..fddcafcbe 100644 --- a/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java +++ b/sample/src/main/java/com/loopj/android/http/sample/util/SecureSocketFactory.java @@ -18,7 +18,6 @@ package com.loopj.android.http.sample.util; -import android.os.Build; import android.util.Log; import com.loopj.android.http.AsyncHttpClient; @@ -189,11 +188,9 @@ public Socket createSocket() throws IOException { */ private void injectHostname(Socket socket, String host) { try { - if (Integer.valueOf(Build.VERSION.SDK) >= 4) { - Field field = InetAddress.class.getDeclaredField("hostName"); - field.setAccessible(true); - field.set(socket.getInetAddress(), host); - } + Field field = InetAddress.class.getDeclaredField("hostName"); + field.setAccessible(true); + field.set(socket.getInetAddress(), host); } catch (Exception ignored) { } } diff --git a/sample/src/standard/java/com/loopj/android/http/sample/SampleApplication.java b/sample/src/standard/java/com/loopj/android/http/sample/SampleApplication.java index 2ef13dc0c..84522ce94 100644 --- a/sample/src/standard/java/com/loopj/android/http/sample/SampleApplication.java +++ b/sample/src/standard/java/com/loopj/android/http/sample/SampleApplication.java @@ -18,17 +18,15 @@ public void onCreate() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setStrictMode() { - if (Integer.valueOf(Build.VERSION.SDK) > 3) { - Log.d(LOG_TAG, "Enabling StrictMode policy over Sample application"); - StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() - .detectAll() - .penaltyLog() - .penaltyDeath() - .build()); - StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() - .detectAll() - .penaltyLog() - .build()); - } + Log.d(LOG_TAG, "Enabling StrictMode policy over Sample application"); + StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() + .detectAll() + .penaltyLog() + .penaltyDeath() + .build()); + StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() + .detectAll() + .penaltyLog() + .build()); } } From 01ea344166720cb059ace951b70753487ec25ce6 Mon Sep 17 00:00:00 2001 From: Marek Sebera Date: Mon, 29 Jun 2020 09:31:09 +0200 Subject: [PATCH 44/47] Release 1.4.11 along with publishing manual --- CHANGELOG.md | 4 +++ PUBLISHING.md | 48 +++++++++++++++++++++++++++++ README.md | 15 ++++----- build.gradle | 2 +- gradle.properties | 4 +-- sample/build.gradle | 2 +- sample/src/main/AndroidManifest.xml | 4 +-- 7 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 PUBLISHING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 311e8074f..72c4b65f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 1.4.11 + + - fix SNI issue on lower android device with Conscrypt + ## 1.4.10 - Fixed IP/name resolution errors #998 diff --git a/PUBLISHING.md b/PUBLISHING.md new file mode 100644 index 000000000..9ac180688 --- /dev/null +++ b/PUBLISHING.md @@ -0,0 +1,48 @@ +# Publish to oss.sonatype.org staging repository + +``` +gradle clean +# edit build.gradle to update allprojects.version +# edit gradle.properties to update VERSION_NAME and VERSION_CODE +# edit CHANGELOG.md and add changes for published version +# edit sample/src/main/AndroidManifest.xml and update both versionCode and versionName attributes +# edit README.md and update paths, latest version, repository links and sample codes +gradle check +# fix all possible errors and warnings before publishing +cd library +# publishing only library, so following tasks are run in "library" sub-folder +gradle generateJavadocJar +# this will create javadoc archive check the contents via following cmd (use different name and/or path if needed) +# jar -tf ./library/build/libs/android-async-http-null-Release-1.4.11-javadoc.jar +gradle publish +``` + +# Publish to maven central + +*For Nexus Repository Manager 2.14+* + + - Login into https://oss.sonatype.org/ + - Navigation, choose Build Promotion > Staging Repositories + - Explore if repo was automatically created and if contents do match expectations + - Select repository and use "Close" action, to run pre-publishing checks + - Wait a bit + - Refresh the panel with repositories + - Select repository and use "Release" action, if not available, there are issues, that need to be fixed before publishing + +# In GIT + + +**example code using 1.4.11 as released version** +``` +git tag 1.4.11 +git push origin --tags +``` + +# Github + +in *releases* https://github.com/android-async-http/android-async-http/releases + + - Create new release from appropriate tag (see GIT above) + - Describe in similar terms as in CHANGELOG.md what is being done + - Upload JAR (library, sources and javadoc) and AAR (library) along with the release + - Publish by saving form diff --git a/README.md b/README.md index 9f8df0429..25871358f 100755 --- a/README.md +++ b/README.md @@ -38,14 +38,14 @@ An asynchronous, callback-based Http client for Android built on top of Apache's Changelog --------- -See what is new in version 1.4.10 released on 20th July 2019 +See what is new in version 1.4.11 released on 29th June 2020 -https://github.com/android-async-http/android-async-http/blob/1.4.10/CHANGELOG.md +https://github.com/android-async-http/android-async-http/blob/1.4.11/CHANGELOG.md Javadoc ------- -Latest Javadoc for 1.4.10 release are available here (also included in Maven repository): +Latest Javadoc for 1.4.11 release are available here (also included in Maven repository): https://android-async-http.github.io/android-async-http/doc/ @@ -66,7 +66,7 @@ Examples -------- For inspiration and testing on device we've provided Sample Application. -See individual samples [here on Github](https://github.com/android-async-http/android-async-http/tree/1.4.10/sample/src/main/java/com/loopj/android/http/sample) +See individual samples [here on Github](https://github.com/android-async-http/android-async-http/tree/1.4.11/sample/src/main/java/com/loopj/android/http/sample) To run Sample application, simply clone the repository and run this command, to install it on connected device ```java @@ -84,7 +84,7 @@ https://repo1.maven.org/maven2/com/loopj/android/android-async-http/ Maven URL: https://repo1.maven.org/maven2/ GroupId: com.loopj.android ArtifactId: android-async-http -Version: 1.4.10 +Version: 1.4.11 Packaging: JAR or AAR ``` Gradle @@ -94,18 +94,19 @@ repositories { } dependencies { - implementation 'com.loopj.android:android-async-http:1.4.10' + implementation 'com.loopj.android:android-async-http:1.4.11' } ``` **development snapshots** +snapshot might not be published yet https://oss.sonatype.org/content/repositories/snapshots/com/loopj/android/android-async-http/ ``` Maven URL: https://oss.sonatype.org/content/repositories/snapshots/ GroupId: com.loopj.android ArtifactId: android-async-http -Version: 1.4.11-SNAPSHOT +Version: 1.4.12-SNAPSHOT Packaging: JAR or AAR ``` Gradle diff --git a/build.gradle b/build.gradle index 2eb6cbb57..2b8e1368e 100755 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ def isReleaseBuild() { allprojects { group = 'com.loopj.android' - version = '1.4.10' + version = '1.4.11' repositories { google() diff --git a/gradle.properties b/gradle.properties index eae99249a..c9086631a 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=1.4.10 -VERSION_CODE=1410 +VERSION_NAME=1.4.11 +VERSION_CODE=1411 GROUP=com.loopj.android POM_DESCRIPTION=An Asynchronous HTTP Library for Android diff --git a/sample/build.gradle b/sample/build.gradle index 6f4172494..a964a667f 100755 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -38,6 +38,6 @@ android { } dependencies { - implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.3' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.0' implementation project(':android-async-http') } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 09ed764f8..3f4f13d4f 100755 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="9" + android:versionName="1.4.11"> From 11a01738aca0923c9d38992bb2af23520325956c Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Thu, 2 Jul 2020 10:08:53 -0700 Subject: [PATCH 45/47] Update README.md --- README.md | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/README.md b/README.md index 25871358f..38c948f73 100755 --- a/README.md +++ b/README.md @@ -1,34 +1,3 @@ -# This project under develop, and is currently insecure to use - -Since there were no active maintainers for this project for a long time, and issues got stale, -security issues pile up and it's not viable to maintain this project further, given there are -quality replacements, this project is closing down. - -This library has many issues handling modern TLS/SSL security protocols using and problems with validating -chain-of-trust of remote services, it communicates with. It also suffers from high-memory-usage issues, -when handling large upstream or downstream jobs. - -It is not suitable for modern projects, and thus, unless someone takes over the maintenance and invests big time -into making it performance and secure again, it is not recommended to use the library further. - -For issues with using this library or migrating to different one, use appropriate forum, for example -[https://stackoverflow.com/questions/tagged/android-async-http](https://stackoverflow.com/questions/tagged/android-async-http) - -## Use these alternatives, as replacement in your app please: - - - [OkHttp](https://square.github.io/okhttp/) https://square.github.io/okhttp/ - - [Volley](https://developer.android.com/training/volley) https://developer.android.com/training/volley - - [RetroFit](https://square.github.io/retrofit/) https://square.github.io/retrofit/ - -*or don't, i'm not a cop* - ---- ---- ---- ---- - - - Asynchronous Http Client for Android ==================================== [![Build Status](https://travis-ci.org/android-async-http/android-async-http.png?branch=master)](https://travis-ci.org/android-async-http/android-async-http) @@ -61,6 +30,7 @@ Features - Automatic **gzip** response decoding support for super-fast requests - Optional built-in response parsing into **JSON** (JsonHttpResponseHandler) - Optional **persistent cookie store**, saves cookies into your app's SharedPreferences +- Support sni with Conscrypt on older android device Examples -------- From a443353a6dc2124ad5b05cfe8aa09deb5f2f9467 Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Wed, 5 Aug 2020 16:32:51 +0430 Subject: [PATCH 46/47] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38c948f73..1ff6c9f85 100755 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Features - Automatic **gzip** response decoding support for super-fast requests - Optional built-in response parsing into **JSON** (JsonHttpResponseHandler) - Optional **persistent cookie store**, saves cookies into your app's SharedPreferences -- Support sni with Conscrypt on older android device +- Support sni with Conscrypt on older android device ([wiki](https://github.com/android-async-http/android-async-http/wiki/Support-SNI-on-lower-android-device)) Examples -------- From 018a0b8d96a0dd569de9f8128cfe5d030e0423ef Mon Sep 17 00:00:00 2001 From: Saeed Rezaei Date: Mon, 18 Jan 2021 13:10:25 +0330 Subject: [PATCH 47/47] Apache license 2.0 (#1363) --- LICENSE.md | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.