mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	remove apache httpclient imports
This commit is contained in:
		
							parent
							
								
									6e4ded84d9
								
							
						
					
					
						commit
						0d0b711556
					
				| @ -162,17 +162,6 @@ public class OwnCloudClientFactory { | ||||
|      * @return          A OwnCloudClient object ready to be used | ||||
|      */ | ||||
|     public static OwnCloudClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects) { | ||||
|         try { | ||||
|             NetworkUtils.registerAdvancedSslContext(true, context); | ||||
|         }  catch (GeneralSecurityException e) { | ||||
|             Log_OC.e(TAG, "Advanced SSL Context could not be loaded. Default SSL management in" + | ||||
|                     " the system will be used for HTTPS connections", e); | ||||
|              | ||||
|         } catch (IOException e) { | ||||
|             Log_OC.e(TAG, "The local server truststore could not be read. Default SSL management" + | ||||
|                     " in the system will be used for HTTPS connections", e); | ||||
|         } | ||||
|          | ||||
|         OwnCloudClient client = new OwnCloudClient(uri); | ||||
| 
 | ||||
|         client.setDefaultTimeouts(DEFAULT_DATA_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); | ||||
|  | ||||
| @ -29,7 +29,7 @@ import java.util.Iterator; | ||||
| import java.util.concurrent.ConcurrentHashMap; | ||||
| import java.util.concurrent.ConcurrentMap; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.cookie.CookiePolicy; | ||||
| 
 | ||||
| 
 | ||||
| import android.accounts.Account; | ||||
| import android.accounts.AuthenticatorException; | ||||
|  | ||||
| @ -31,11 +31,11 @@ import com.owncloud.android.lib.common.http.interceptors.HttpInterceptor; | ||||
| import com.owncloud.android.lib.common.http.interceptors.HttpInterceptor.RequestInterceptor; | ||||
| import com.owncloud.android.lib.common.http.interceptors.SamlAuthInterceptor; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.UsernamePasswordCredentials; | ||||
| import org.apache.commons.httpclient.auth.AuthPolicy; | ||||
| import org.apache.commons.httpclient.auth.AuthScope; | ||||
| import org.apache.commons.httpclient.auth.AuthState; | ||||
| import org.apache.commons.httpclient.auth.BasicScheme; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| @ -62,11 +62,6 @@ public class OwnCloudBasicCredentials implements OwnCloudCredentials { | ||||
| 
 | ||||
|     @Override | ||||
|     public void applyTo(OwnCloudClient client) { | ||||
|         AuthPolicy.registerAuthScheme(AuthState.PREEMPTIVE_AUTH_SCHEME, BasicScheme.class); | ||||
| 
 | ||||
|         List<String> authPrefs = new ArrayList<>(1); | ||||
|         authPrefs.add(AuthPolicy.BASIC); | ||||
| 
 | ||||
|         ArrayList<RequestInterceptor> requestInterceptors = HttpClient.getOkHttpInterceptor().getRequestInterceptors(); | ||||
| 
 | ||||
|         // Clear previous basic credentials | ||||
|  | ||||
| @ -23,18 +23,10 @@ | ||||
|  */ | ||||
| package com.owncloud.android.lib.common.authentication; | ||||
| 
 | ||||
| import android.app.DownloadManager; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.auth.AuthPolicy; | ||||
| import org.apache.commons.httpclient.auth.AuthScope; | ||||
| import org.apache.commons.httpclient.auth.AuthState; | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.OwnCloudClient; | ||||
| import com.owncloud.android.lib.common.authentication.oauth.BearerAuthScheme; | ||||
| import com.owncloud.android.lib.common.authentication.oauth.BearerCredentials; | ||||
| import com.owncloud.android.lib.common.http.HttpClient; | ||||
| import com.owncloud.android.lib.common.http.interceptors.BarearAuthInterceptor; | ||||
| import com.owncloud.android.lib.common.http.interceptors.BasicAuthInterceptor; | ||||
| @ -53,8 +45,6 @@ public class OwnCloudBearerCredentials implements OwnCloudCredentials { | ||||
| 
 | ||||
|     @Override | ||||
|     public void applyTo(OwnCloudClient client) { | ||||
|         AuthPolicy.registerAuthScheme(BearerAuthScheme.AUTH_POLICY, BearerAuthScheme.class); | ||||
|         AuthPolicy.registerAuthScheme(AuthState.PREEMPTIVE_AUTH_SCHEME, BearerAuthScheme.class); | ||||
| 
 | ||||
|         final ArrayList<HttpInterceptor.RequestInterceptor> requestInterceptors = | ||||
|                 HttpClient.getOkHttpInterceptor().getRequestInterceptors(); | ||||
|  | ||||
| @ -23,7 +23,7 @@ | ||||
|  */ | ||||
| package com.owncloud.android.lib.common.authentication; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.cookie.CookiePolicy; | ||||
| 
 | ||||
| 
 | ||||
| import android.net.Uri; | ||||
| 
 | ||||
|  | ||||
| @ -1,262 +0,0 @@ | ||||
| /* ownCloud Android Library is available under MIT license | ||||
|  *   Copyright (C) 2016 ownCloud GmbH. | ||||
|  *    | ||||
|  *   Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|  *   of this software and associated documentation files (the "Software"), to deal | ||||
|  *   in the Software without restriction, including without limitation the rights | ||||
|  *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
|  *   copies of the Software, and to permit persons to whom the Software is | ||||
|  *   furnished to do so, subject to the following conditions: | ||||
|  *    | ||||
|  *   The above copyright notice and this permission notice shall be included in | ||||
|  *   all copies or substantial portions of the Software. | ||||
|  *    | ||||
|  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  | ||||
|  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  | ||||
|  *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS  | ||||
|  *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  | ||||
|  *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  | ||||
|  *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
|  *   THE SOFTWARE. | ||||
|  * | ||||
|  */ | ||||
| 
 | ||||
| package com.owncloud.android.lib.common.authentication.oauth; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.Credentials; | ||||
| import org.apache.commons.httpclient.HttpMethod; | ||||
| import org.apache.commons.httpclient.auth.AuthChallengeParser; | ||||
| import org.apache.commons.httpclient.auth.AuthScheme; | ||||
| import org.apache.commons.httpclient.auth.AuthenticationException; | ||||
| import org.apache.commons.httpclient.auth.InvalidCredentialsException; | ||||
| import org.apache.commons.httpclient.auth.MalformedChallengeException; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Bearer authentication scheme as defined in RFC 6750. | ||||
|  *  | ||||
|  * @author David A. Velasco | ||||
|  */ | ||||
| 
 | ||||
| public class BearerAuthScheme implements AuthScheme /*extends RFC2617Scheme*/ { | ||||
|      | ||||
|     private static final String TAG = BearerAuthScheme.class.getSimpleName(); | ||||
| 
 | ||||
|     public static final String AUTH_POLICY = "Bearer"; | ||||
|      | ||||
|     /** Whether the bearer authentication process is complete */ | ||||
|     private boolean mComplete; | ||||
|      | ||||
|     /** Authentication parameter map */ | ||||
|     @SuppressWarnings("rawtypes") | ||||
| 	private Map mParams = null; | ||||
|      | ||||
|      | ||||
|     /** | ||||
|      * Default constructor for the bearer authentication scheme. | ||||
|      */ | ||||
|     public BearerAuthScheme() { | ||||
|         mComplete = false; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Constructor for the basic authentication scheme. | ||||
|      *  | ||||
|      * @param   challenge                       Authentication challenge | ||||
|      *  | ||||
|      * @throws  MalformedChallengeException     Thrown if the authentication challenge is malformed | ||||
|      */ | ||||
|     public BearerAuthScheme(final String challenge) throws MalformedChallengeException { | ||||
|         processChallenge(challenge); | ||||
|         mComplete = true; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Returns textual designation of the bearer authentication scheme. | ||||
|      *  | ||||
|      * @return "Bearer" | ||||
|      */ | ||||
|     public String getSchemeName() { | ||||
|         return "bearer"; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Processes the Bearer challenge. | ||||
|      *   | ||||
|      * @param   challenge                   The challenge string | ||||
|      *  | ||||
|      * @throws MalformedChallengeException  Thrown if the authentication challenge is malformed | ||||
|      */ | ||||
|     public void processChallenge(String challenge) throws MalformedChallengeException { | ||||
|         String s = AuthChallengeParser.extractScheme(challenge); | ||||
|         if (!s.equalsIgnoreCase(getSchemeName())) { | ||||
|             throw new MalformedChallengeException( | ||||
|               "Invalid " + getSchemeName() + " challenge: " + challenge);  | ||||
|         } | ||||
|         mParams = AuthChallengeParser.extractParams(challenge); | ||||
|         mComplete = true; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Tests if the Bearer authentication process has been completed. | ||||
|      *  | ||||
|      * @return 'true' if Bearer authorization has been processed, 'false' otherwise. | ||||
|      */ | ||||
|     public boolean isComplete() { | ||||
|         return this.mComplete; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Produces bearer authorization string for the given set of  | ||||
|      * {@link Credentials}. | ||||
|      *  | ||||
|      * @param   credentials                     The set of credentials to be used for authentication | ||||
|      * @param   method                          Method name is ignored by the bearer authentication scheme | ||||
|      * @param   uri                             URI is ignored by the bearer authentication scheme | ||||
|      * @throws  InvalidCredentialsException     If authentication credentials are not valid or not applicable  | ||||
|      *                                          for this authentication scheme | ||||
|      * @throws  AuthenticationException         If authorization string cannot be generated due to an authentication failure | ||||
|      * @return  A bearer authorization string | ||||
|      */ | ||||
|     public String authenticate(Credentials credentials, String method, String uri) throws AuthenticationException { | ||||
|         BearerCredentials bearer; | ||||
|         try { | ||||
|             bearer = (BearerCredentials) credentials; | ||||
|         } catch (ClassCastException e) { | ||||
|             throw new InvalidCredentialsException( | ||||
|              "Credentials cannot be used for bearer authentication: "  | ||||
|               + credentials.getClass().getName()); | ||||
|         } | ||||
|         return BearerAuthScheme.authenticate(bearer); | ||||
|     } | ||||
| 
 | ||||
|      | ||||
|     /** | ||||
|      * Returns 'false'. Bearer authentication scheme is request based. | ||||
|      *  | ||||
|      * @return 'false'. | ||||
|      */ | ||||
|     public boolean isConnectionBased() { | ||||
|         return false;     | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Produces bearer authorization string for the given set of {@link Credentials}. | ||||
|      *  | ||||
|      * @param   credentials                     The set of credentials to be used for authentication | ||||
|      * @param   method                          The method being authenticated | ||||
|      * @throws  InvalidCredentialsException     If authentication credentials are not valid or not applicable for this authentication  | ||||
|      *                                          scheme. | ||||
|      * @throws AuthenticationException         If authorization string cannot be generated due to an authentication failure. | ||||
|      *  | ||||
|      * @return a basic authorization string | ||||
|      */ | ||||
|     public String authenticate(Credentials credentials, HttpMethod method) throws AuthenticationException { | ||||
|         if (method == null) { | ||||
|             throw new IllegalArgumentException("Method may not be null"); | ||||
|         } | ||||
|         BearerCredentials bearer = null; | ||||
|         try { | ||||
|             bearer = (BearerCredentials) credentials; | ||||
|         } catch (ClassCastException e) { | ||||
|             throw new InvalidCredentialsException( | ||||
|                     "Credentials cannot be used for bearer authentication: "  | ||||
|                     + credentials.getClass().getName()); | ||||
|         } | ||||
|         return BearerAuthScheme.authenticate( | ||||
|             bearer,  | ||||
|             method.getParams().getCredentialCharset()); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Returns a bearer Authorization header value for the given | ||||
|      * {@link BearerCredentials}. | ||||
|      *  | ||||
|      * @param   credentials     The credentials to encode. | ||||
|      *  | ||||
|      * @return                  A bearer authorization string | ||||
|      */ | ||||
|     public static String authenticate(BearerCredentials credentials) { | ||||
|         return authenticate(credentials, "ISO-8859-1"); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Returns a bearer Authorization header value for the given  | ||||
|      * {@link BearerCredentials} and charset. | ||||
|      *  | ||||
|      * @param   credentials         The credentials to encode. | ||||
|      * @param   charset             The charset to use for encoding the credentials | ||||
|      *  | ||||
|      * @return                      A bearer authorization string | ||||
|      *  | ||||
|      * @since 3.0 | ||||
|      */ | ||||
|     public static String authenticate(BearerCredentials credentials, String charset) { | ||||
| 
 | ||||
|         if (credentials == null) { | ||||
|             throw new IllegalArgumentException("Credentials may not be null");  | ||||
|         } | ||||
|         if (charset == null || charset.length() == 0) { | ||||
|             throw new IllegalArgumentException("charset may not be null or empty"); | ||||
|         } | ||||
|         StringBuffer buffer = new StringBuffer(); | ||||
|         buffer.append(credentials.getAccessToken()); | ||||
| 
 | ||||
|         return "Bearer " + buffer.toString(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Returns a String identifying the authentication challenge.  This is | ||||
|      * used, in combination with the host and port to determine if | ||||
|      * authorization has already been attempted or not.  Schemes which | ||||
|      * require multiple requests to complete the authentication should | ||||
|      * return a different value for each stage in the request. | ||||
|      *  | ||||
|      * Additionally, the ID should take into account any changes to the | ||||
|      * authentication challenge and return a different value when appropriate. | ||||
|      * For example when the realm changes in basic authentication it should be | ||||
|      * considered a different authentication attempt and a different value should | ||||
|      * be returned. | ||||
|      *  | ||||
|      * This method simply returns the realm for the challenge. | ||||
|      *  | ||||
|      * @return String       a String identifying the authentication challenge. | ||||
|      */ | ||||
|     @Override | ||||
|     public String getID() { | ||||
|         return getRealm(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Returns authentication parameter with the given name, if available. | ||||
|      *  | ||||
|      * @param   name    The name of the parameter to be returned | ||||
|      *  | ||||
|      * @return          The parameter with the given name | ||||
|      */ | ||||
|     @Override | ||||
|     public String getParameter(String name) { | ||||
|         if (name == null) { | ||||
|             throw new IllegalArgumentException("Parameter name may not be null");  | ||||
|         } | ||||
|         if (mParams == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return (String) mParams.get(name.toLowerCase()); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Returns authentication realm. The realm may not be null. | ||||
|      *  | ||||
|      * @return  The authentication realm | ||||
|      */ | ||||
|     @Override | ||||
|     public String getRealm() { | ||||
|         return getParameter("realm"); | ||||
|     } | ||||
|      | ||||
| } | ||||
| @ -24,16 +24,15 @@ | ||||
| 
 | ||||
| package com.owncloud.android.lib.common.authentication.oauth; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.Credentials; | ||||
| import org.apache.commons.httpclient.util.LangUtils; | ||||
| 
 | ||||
| /** | ||||
|  * Bearer token {@link Credentials} | ||||
|  * | ||||
|  * @author David A. Velasco | ||||
|  */ | ||||
| public class BearerCredentials implements Credentials { | ||||
| public class BearerCredentials { | ||||
| 
 | ||||
|     public static final int HASH_SEED = 17; | ||||
|     public static final int HASH_OFFSET = 37; | ||||
|      | ||||
|     private String mAccessToken; | ||||
|      | ||||
| @ -76,9 +75,7 @@ public class BearerCredentials implements Credentials { | ||||
|      * @return The hash code of the access token | ||||
|      */ | ||||
|     public int hashCode() { | ||||
|         int hash = LangUtils.HASH_SEED; | ||||
|         hash = LangUtils.hashCode(hash, mAccessToken); | ||||
|         return hash; | ||||
|        return HASH_SEED * HASH_OFFSET + mAccessToken.hashCode(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @ -93,7 +90,7 @@ public class BearerCredentials implements Credentials { | ||||
|         if (this == o) return true; | ||||
|         if (this.getClass().equals(o.getClass())) { | ||||
|             BearerCredentials that = (BearerCredentials) o; | ||||
|             if (LangUtils.equals(mAccessToken, that.mAccessToken)) { | ||||
|             if (mAccessToken.equals(that.mAccessToken)) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -29,6 +29,10 @@ package com.owncloud.android.lib.common.http; | ||||
|  */ | ||||
| public class HttpConstants { | ||||
| 
 | ||||
|     /*********************************************************************************************************** | ||||
|      *************************************************** HEADERS *********************************************** | ||||
|      ***********************************************************************************************************/ | ||||
| 
 | ||||
|     /*********************************************************************************************************** | ||||
|      *************************************************** HEADERS *********************************************** | ||||
|      ***********************************************************************************************************/ | ||||
|  | ||||
| @ -1,344 +0,0 @@ | ||||
| /* ownCloud Android Library is available under MIT license | ||||
|  *   Copyright (C) 2016 ownCloud GmbH. | ||||
|  *    | ||||
|  *   Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|  *   of this software and associated documentation files (the "Software"), to deal | ||||
|  *   in the Software without restriction, including without limitation the rights | ||||
|  *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
|  *   copies of the Software, and to permit persons to whom the Software is | ||||
|  *   furnished to do so, subject to the following conditions: | ||||
|  *    | ||||
|  *   The above copyright notice and this permission notice shall be included in | ||||
|  *   all copies or substantial portions of the Software. | ||||
|  *    | ||||
|  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  | ||||
|  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  | ||||
|  *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS  | ||||
|  *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  | ||||
|  *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  | ||||
|  *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
|  *   THE SOFTWARE. | ||||
|  * | ||||
|  */ | ||||
| 
 | ||||
| package com.owncloud.android.lib.common.network; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
| import java.net.InetAddress; | ||||
| import java.net.InetSocketAddress; | ||||
| import java.net.Socket; | ||||
| import java.net.SocketAddress; | ||||
| import java.net.UnknownHostException; | ||||
| import java.security.cert.X509Certificate; | ||||
| 
 | ||||
| import javax.net.SocketFactory; | ||||
| import javax.net.ssl.SSLContext; | ||||
| import javax.net.ssl.SSLException; | ||||
| import javax.net.ssl.SSLHandshakeException; | ||||
| import javax.net.ssl.SSLParameters; | ||||
| import javax.net.ssl.SSLPeerUnverifiedException; | ||||
| import javax.net.ssl.SSLSession; | ||||
| import javax.net.ssl.SSLSocket; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.ConnectTimeoutException; | ||||
| import org.apache.commons.httpclient.params.HttpConnectionParams; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; | ||||
| import org.apache.http.conn.ssl.X509HostnameVerifier; | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.utils.Log_OC; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * AdvancedSSLProtocolSocketFactory allows to create SSL {@link Socket}s with | ||||
|  * a custom SSLContext and an optional Hostname Verifier. | ||||
|  * | ||||
|  * @author David A. Velasco | ||||
|  */ | ||||
| 
 | ||||
| public class AdvancedSslSocketFactory implements SecureProtocolSocketFactory { | ||||
| 
 | ||||
|     private static final String TAG = AdvancedSslSocketFactory.class.getSimpleName(); | ||||
| 
 | ||||
|     private SSLContext mSslContext = null; | ||||
|     private AdvancedX509TrustManager mTrustManager = null; | ||||
|     private X509HostnameVerifier mHostnameVerifier = null; | ||||
| 
 | ||||
|     public SSLContext getSslContext() { | ||||
|         return mSslContext; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Constructor for AdvancedSSLProtocolSocketFactory. | ||||
|      */ | ||||
|     public AdvancedSslSocketFactory( | ||||
|         SSLContext sslContext, AdvancedX509TrustManager trustManager, X509HostnameVerifier hostnameVerifier | ||||
|     ) { | ||||
| 
 | ||||
|         if (sslContext == null) | ||||
|             throw new IllegalArgumentException("AdvancedSslSocketFactory can not be created with a null SSLContext"); | ||||
|         if (trustManager == null && mHostnameVerifier != null) | ||||
|             throw new IllegalArgumentException( | ||||
|                 "AdvancedSslSocketFactory can not be created with a null Trust Manager and a " + | ||||
|                     "not null Hostname Verifier" | ||||
|             ); | ||||
|         mSslContext = sslContext; | ||||
|         mTrustManager = trustManager; | ||||
|         mHostnameVerifier = hostnameVerifier; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @see ProtocolSocketFactory#createSocket(java.lang.String, int, java.net.InetAddress, int) | ||||
|      */ | ||||
|     @Override | ||||
|     public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort) | ||||
|         throws IOException, UnknownHostException { | ||||
| 
 | ||||
|         Socket socket = mSslContext.getSocketFactory().createSocket(host, port, clientHost, clientPort); | ||||
|         enableSecureProtocols(socket); | ||||
|         verifyPeerIdentity(host, port, socket); | ||||
|         return socket; | ||||
|     } | ||||
| 
 | ||||
|     /* | ||||
|     private void logSslInfo() { | ||||
|     	if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) { | ||||
| 	    	Log_OC.v(TAG, "SUPPORTED SSL PARAMETERS"); | ||||
| 	    	logSslParameters(mSslContext.getSupportedSSLParameters()); | ||||
| 	    	Log_OC.v(TAG, "DEFAULT SSL PARAMETERS"); | ||||
| 	    	logSslParameters(mSslContext.getDefaultSSLParameters()); | ||||
| 	    	Log_OC.i(TAG, "CURRENT PARAMETERS"); | ||||
| 	    	Log_OC.i(TAG, "Protocol: " + mSslContext.getProtocol()); | ||||
|     	} | ||||
|     	Log_OC.i(TAG, "PROVIDER"); | ||||
|     	logSecurityProvider(mSslContext.getProvider()); | ||||
| 	} | ||||
|      | ||||
|     private void logSecurityProvider(Provider provider) { | ||||
|     	Log_OC.i(TAG, "name: " + provider.getName()); | ||||
|     	Log_OC.i(TAG, "version: " + provider.getVersion()); | ||||
|     	Log_OC.i(TAG, "info: " + provider.getInfo()); | ||||
|     	Enumeration<?> keys = provider.propertyNames(); | ||||
|     	String key; | ||||
|     	while (keys.hasMoreElements()) { | ||||
|     		key = (String) keys.nextElement(); | ||||
|         	Log_OC.i(TAG, "  property " + key + " : " + provider.getProperty(key)); | ||||
|     	} | ||||
| 	} | ||||
| 
 | ||||
| 	private void logSslParameters(SSLParameters params) { | ||||
|     	Log_OC.v(TAG, "Cipher suites: "); | ||||
|     	String [] elements = params.getCipherSuites(); | ||||
|     	for (int i=0; i<elements.length ; i++) { | ||||
|     		Log_OC.v(TAG, "  " + elements[i]); | ||||
|     	} | ||||
|     	Log_OC.v(TAG, "Protocols: "); | ||||
|     	elements = params.getProtocols(); | ||||
|     	for (int i=0; i<elements.length ; i++) { | ||||
|     		Log_OC.v(TAG, "  " + elements[i]); | ||||
|     	} | ||||
| 	} | ||||
| 	*/ | ||||
| 
 | ||||
|     /** | ||||
|      * Attempts to get a new socket connection to the given host within the | ||||
|      * given time limit. | ||||
|      * | ||||
|      * @param host         the host name/IP | ||||
|      * @param port         the port on the host | ||||
|      * @param localAddress the local host name/IP to bind the socket to | ||||
|      * @param localPort    the port on the local machine | ||||
|      * @param params       {@link HttpConnectionParams Http connection parameters} | ||||
|      * @return Socket a new socket | ||||
|      * @throws IOException          if an I/O error occurs while creating the socket | ||||
|      * @throws UnknownHostException if the IP address of the host cannot be | ||||
|      *                              determined | ||||
|      */ | ||||
|     @Override | ||||
|     public Socket createSocket(final String host, final int port, | ||||
|                                final InetAddress localAddress, final int localPort, | ||||
|                                final HttpConnectionParams params) throws IOException, | ||||
|         UnknownHostException, ConnectTimeoutException { | ||||
|         Log_OC.d(TAG, "Creating SSL Socket with remote " + host + ":" + port + ", local " + localAddress + ":" + | ||||
|             localPort + ", params: " + params); | ||||
|         if (params == null) { | ||||
|             throw new IllegalArgumentException("Parameters may not be null"); | ||||
|         } | ||||
|         int timeout = params.getConnectionTimeout(); | ||||
| 
 | ||||
|         //logSslInfo(); | ||||
| 
 | ||||
|         SocketFactory socketfactory = mSslContext.getSocketFactory(); | ||||
|         Log_OC.d(TAG, " ... with connection timeout " + timeout + " and socket timeout " + params.getSoTimeout()); | ||||
|         Socket socket = socketfactory.createSocket(); | ||||
|         enableSecureProtocols(socket); | ||||
|         SocketAddress localaddr = new InetSocketAddress(localAddress, localPort); | ||||
|         SocketAddress remoteaddr = new InetSocketAddress(host, port); | ||||
|         socket.setSoTimeout(params.getSoTimeout()); | ||||
|         WriteTimeoutEnforcer.setSoWriteTimeout(params.getSoTimeout(), socket); | ||||
|         socket.bind(localaddr); | ||||
|         ServerNameIndicator.setServerNameIndication(host, (SSLSocket) socket); | ||||
|         socket.connect(remoteaddr, timeout); | ||||
|         verifyPeerIdentity(host, port, socket); | ||||
|         return socket; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @see ProtocolSocketFactory#createSocket(java.lang.String, int) | ||||
|      */ | ||||
|     @Override | ||||
|     public Socket createSocket(String host, int port) throws IOException, | ||||
|         UnknownHostException { | ||||
|         Log_OC.d(TAG, "Creating SSL Socket with remote " + host + ":" + port); | ||||
|         Socket socket = mSslContext.getSocketFactory().createSocket(host, port); | ||||
|         enableSecureProtocols(socket); | ||||
|         verifyPeerIdentity(host, port, socket); | ||||
|         return socket; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, | ||||
|         UnknownHostException { | ||||
|         Socket sslSocket = mSslContext.getSocketFactory().createSocket(socket, host, port, autoClose); | ||||
|         enableSecureProtocols(sslSocket); | ||||
|         verifyPeerIdentity(host, port, sslSocket); | ||||
|         return sslSocket; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public boolean equals(Object obj) { | ||||
|         return ((obj != null) && obj.getClass().equals( | ||||
|             AdvancedSslSocketFactory.class)); | ||||
|     } | ||||
| 
 | ||||
|     public int hashCode() { | ||||
|         return AdvancedSslSocketFactory.class.hashCode(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public X509HostnameVerifier getHostNameVerifier() { | ||||
|         return mHostnameVerifier; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public void setHostNameVerifier(X509HostnameVerifier hostnameVerifier) { | ||||
|         mHostnameVerifier = hostnameVerifier; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Verifies the identity of the server. | ||||
|      * | ||||
|      * The server certificate is verified first. | ||||
|      * | ||||
|      * Then, the host name is compared with the content of the server certificate using the current host name verifier, | ||||
|      * if any. | ||||
|      * | ||||
|      * @param socket | ||||
|      */ | ||||
|     private void verifyPeerIdentity(String host, int port, Socket socket) throws IOException { | ||||
|         try { | ||||
|             CertificateCombinedException failInHandshake = null; | ||||
|             /// 1. VERIFY THE SERVER CERTIFICATE through the registered TrustManager  | ||||
|             ///	(that should be an instance of AdvancedX509TrustManager)  | ||||
|             try { | ||||
|                 SSLSocket sock = (SSLSocket) socket;    // a new SSLSession instance is created as a "side effect"  | ||||
|                 sock.startHandshake(); | ||||
| 
 | ||||
|             } catch (RuntimeException e) { | ||||
| 
 | ||||
|                 if (e instanceof CertificateCombinedException) { | ||||
|                     failInHandshake = (CertificateCombinedException) e; | ||||
|                 } else { | ||||
|                     Throwable cause = e.getCause(); | ||||
|                     Throwable previousCause = null; | ||||
|                     while (cause != null && | ||||
|                         cause != previousCause && | ||||
|                         !(cause instanceof CertificateCombinedException)) { | ||||
|                         previousCause = cause; | ||||
|                         cause = cause.getCause(); | ||||
|                     } | ||||
|                     if (cause != null && cause instanceof CertificateCombinedException) { | ||||
|                         failInHandshake = (CertificateCombinedException) cause; | ||||
|                     } | ||||
|                 } | ||||
|                 if (failInHandshake == null) { | ||||
|                     throw e; | ||||
|                 } | ||||
|                 failInHandshake.setHostInUrl(host); | ||||
| 
 | ||||
|             } | ||||
| 
 | ||||
|             /// 2. VERIFY HOSTNAME | ||||
|             SSLSession newSession = null; | ||||
|             boolean verifiedHostname = true; | ||||
|             if (mHostnameVerifier != null) { | ||||
|                 if (failInHandshake != null) { | ||||
|                     /// 2.1 : a new SSLSession instance was NOT created in the handshake | ||||
|                     X509Certificate serverCert = failInHandshake.getServerCertificate(); | ||||
|                     try { | ||||
|                         mHostnameVerifier.verify(host, serverCert); | ||||
|                     } catch (SSLException e) { | ||||
|                         verifiedHostname = false; | ||||
|                     } | ||||
| 
 | ||||
|                 } else { | ||||
|                     /// 2.2 : a new SSLSession instance was created in the handshake | ||||
|                     newSession = ((SSLSocket) socket).getSession(); | ||||
|                     if (!mTrustManager.isKnownServer((X509Certificate) (newSession.getPeerCertificates()[0]))) { | ||||
|                         verifiedHostname = mHostnameVerifier.verify(host, newSession); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             /// 3. Combine the exceptions to throw, if any | ||||
|             if (!verifiedHostname) { | ||||
|                 SSLPeerUnverifiedException pue = new SSLPeerUnverifiedException( | ||||
|                     "Names in the server certificate do not match to " + host + " in the URL" | ||||
|                 ); | ||||
|                 if (failInHandshake == null) { | ||||
|                     failInHandshake = new CertificateCombinedException( | ||||
|                         (X509Certificate) newSession.getPeerCertificates()[0] | ||||
|                     ); | ||||
|                     failInHandshake.setHostInUrl(host); | ||||
|                 } | ||||
|                 failInHandshake.setSslPeerUnverifiedException(pue); | ||||
|                 pue.initCause(failInHandshake); | ||||
|                 throw pue; | ||||
| 
 | ||||
|             } else if (failInHandshake != null) { | ||||
|                 SSLHandshakeException hse = new SSLHandshakeException("Server certificate could not be verified"); | ||||
|                 hse.initCause(failInHandshake); | ||||
|                 throw hse; | ||||
|             } | ||||
| 
 | ||||
|         } catch (IOException io) { | ||||
|             try { | ||||
|                 socket.close(); | ||||
|             } catch (Exception x) { | ||||
|                 // NOTHING - irrelevant exception for the caller  | ||||
|             } | ||||
|             throw io; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Grants that all protocols supported by the Security Provider in mSslContext are enabled in socket. | ||||
|      * | ||||
|      * Grants also that no unsupported protocol is tried to be enabled. That would trigger an exception, breaking | ||||
|      * the connection process although some protocols are supported. | ||||
|      * | ||||
|      * This is not cosmetic: not all the supported protocols are enabled by default. Too see an overview of | ||||
|      * supported and enabled protocols in the stock Security Provider in Android see the tables in | ||||
|      * http://developer.android.com/reference/javax/net/ssl/SSLSocket.html. | ||||
|      * | ||||
|      * @param socket | ||||
|      */ | ||||
|     private void enableSecureProtocols(Socket socket) { | ||||
|         SSLParameters params = mSslContext.getSupportedSSLParameters(); | ||||
|         String[] supportedProtocols = params.getProtocols(); | ||||
|         ((SSLSocket) socket).setEnabledProtocols(supportedProtocols); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -35,7 +35,7 @@ import java.util.HashSet; | ||||
| import java.util.Iterator; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.methods.RequestEntity; | ||||
| 
 | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.utils.Log_OC; | ||||
| 
 | ||||
| @ -45,7 +45,7 @@ import com.owncloud.android.lib.common.utils.Log_OC; | ||||
|  *  | ||||
|  * @author David A. Velasco | ||||
|  */ | ||||
| public class ChunkFromFileChannelRequestEntity implements RequestEntity, ProgressiveDataTransferer { | ||||
| public class ChunkFromFileChannelRequestEntity implements ProgressiveDataTransferer { | ||||
| 
 | ||||
|     private static final String TAG = ChunkFromFileChannelRequestEntity.class.getSimpleName(); | ||||
|      | ||||
|  | ||||
| @ -25,18 +25,12 @@ | ||||
| 
 | ||||
| package com.owncloud.android.lib.common.network; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.methods.RequestEntity; | ||||
| 
 | ||||
| 
 | ||||
| import java.io.File; | ||||
| import java.io.FileNotFoundException; | ||||
| import java.io.IOException; | ||||
| import java.io.OutputStream; | ||||
| import java.io.RandomAccessFile; | ||||
| import java.nio.ByteBuffer; | ||||
| import java.nio.channels.FileChannel; | ||||
| import java.util.Collection; | ||||
| import java.util.HashSet; | ||||
| import java.util.Iterator; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| 
 | ||||
| @ -45,7 +39,7 @@ import java.util.Set; | ||||
|  * A RequestEntity that represents a File. | ||||
|  *  | ||||
|  */ | ||||
| public class FileRequestEntity implements RequestEntity, ProgressiveDataTransferer { | ||||
| public class FileRequestEntity implements ProgressiveDataTransferer { | ||||
| 
 | ||||
|     final File mFile; | ||||
|     final String mContentType; | ||||
| @ -60,21 +54,10 @@ public class FileRequestEntity implements RequestEntity, ProgressiveDataTransfer | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public long getContentLength() { | ||||
|         return mFile.length(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String getContentType() { | ||||
|         return mContentType; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean isRepeatable() { | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void addDatatransferProgressListener(OnDatatransferProgressListener listener) { | ||||
|         synchronized (mDataTransferListeners) { | ||||
| @ -96,59 +79,6 @@ public class FileRequestEntity implements RequestEntity, ProgressiveDataTransfer | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|      | ||||
|     @Override | ||||
|     public void writeRequest(final OutputStream out) throws IOException { | ||||
|         ByteBuffer tmp = ByteBuffer.allocate(4096); | ||||
|         int readResult = 0; | ||||
|          | ||||
|         RandomAccessFile raf = new RandomAccessFile(mFile, "r"); | ||||
|         FileChannel channel = raf.getChannel(); | ||||
|         Iterator<OnDatatransferProgressListener> it = null; | ||||
|         long transferred = 0; | ||||
|         long size = mFile.length(); | ||||
|         if (size == 0) size = -1; | ||||
|         try { | ||||
|             while ((readResult = channel.read(tmp)) >= 0) { | ||||
|                 try { | ||||
|                     out.write(tmp.array(), 0, readResult); | ||||
|                 } catch (IOException io) { | ||||
|                     // work-around try catch to filter exception in writing | ||||
|                     throw new WriteException(io); | ||||
|                 } | ||||
|                 tmp.clear(); | ||||
|                 transferred += readResult; | ||||
|                 synchronized (mDataTransferListeners) { | ||||
|                     it = mDataTransferListeners.iterator(); | ||||
|                     while (it.hasNext()) { | ||||
|                         it.next().onTransferProgress(readResult, transferred, size, mFile.getAbsolutePath()); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|         } catch (IOException io) { | ||||
|             // any read problem will be handled as if the file is not there | ||||
|             if (io instanceof FileNotFoundException) { | ||||
|                 throw io; | ||||
|             } else { | ||||
|                 FileNotFoundException fnf = new FileNotFoundException("Exception reading source file"); | ||||
|                 fnf.initCause(io); | ||||
|                 throw fnf; | ||||
|             } | ||||
| 
 | ||||
|         } catch (WriteException we) { | ||||
|             throw we.getWrapped(); | ||||
| 
 | ||||
|         } finally { | ||||
|             try { | ||||
|                 channel.close(); | ||||
|                 raf.close(); | ||||
|             } catch (IOException io) { | ||||
|                 // ignore failures closing source file | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     protected static class WriteException extends Exception { | ||||
|         IOException mWrapped; | ||||
| 
 | ||||
|  | ||||
| @ -39,8 +39,8 @@ import java.security.cert.CertificateException; | ||||
| import javax.net.ssl.SSLContext; | ||||
| import javax.net.ssl.TrustManager; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| 
 | ||||
| 
 | ||||
| import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier; | ||||
| import org.apache.http.conn.ssl.X509HostnameVerifier; | ||||
| 
 | ||||
| @ -64,68 +64,8 @@ public class NetworkUtils { | ||||
|     /** Standard name for protocol TLS version 1.0 in JSSE API */ | ||||
|     public static final String PROTOCOL_TLSv1_0 = "TLSv1"; | ||||
| 
 | ||||
|     /** Connection manager for all the OwnCloudClients */ | ||||
|     private static MultiThreadedHttpConnectionManager mConnManager = null; | ||||
|      | ||||
|     private static Protocol mDefaultHttpsProtocol = null; | ||||
| 
 | ||||
|     private static AdvancedSslSocketFactory mAdvancedSslSocketFactory = null; | ||||
| 
 | ||||
|     private static X509HostnameVerifier mHostnameVerifier = null; | ||||
| 
 | ||||
|      | ||||
|     /** | ||||
|      * Registers or unregisters the proper components for advanced SSL handling. | ||||
|      * @throws IOException  | ||||
|      */ | ||||
|     @SuppressWarnings("deprecation") | ||||
| 	public static void registerAdvancedSslContext(boolean register, Context context)  | ||||
|     		throws GeneralSecurityException, IOException { | ||||
|         Protocol pr = null; | ||||
|         try { | ||||
|             pr = Protocol.getProtocol("https"); | ||||
|             if (pr != null && mDefaultHttpsProtocol == null) { | ||||
|                 mDefaultHttpsProtocol = pr; | ||||
|             } | ||||
|         } catch (IllegalStateException e) { | ||||
|             // nothing to do here; really | ||||
|         } | ||||
|         boolean isRegistered = (pr != null && pr.getSocketFactory() instanceof AdvancedSslSocketFactory); | ||||
|         if (register && !isRegistered) { | ||||
|             Protocol.registerProtocol("https", new Protocol("https", getAdvancedSslSocketFactory(context), 443)); | ||||
|              | ||||
|         } else if (!register && isRegistered) { | ||||
|             if (mDefaultHttpsProtocol != null) { | ||||
|                 Protocol.registerProtocol("https", mDefaultHttpsProtocol); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     public static AdvancedSslSocketFactory getAdvancedSslSocketFactory(Context context)  | ||||
|     		throws GeneralSecurityException, IOException { | ||||
|         if (mAdvancedSslSocketFactory  == null) { | ||||
|             KeyStore trustStore = getKnownServersStore(context); | ||||
|             AdvancedX509TrustManager trustMgr = new AdvancedX509TrustManager(trustStore); | ||||
|             TrustManager[] tms = new TrustManager[] { trustMgr }; | ||||
|                  | ||||
|             SSLContext sslContext; | ||||
|             try { | ||||
|             	sslContext = SSLContext.getInstance("TLSv1.2"); | ||||
|             } catch (NoSuchAlgorithmException e) { | ||||
|             	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 | ||||
|             } | ||||
|             sslContext.init(null, tms, null); | ||||
|                      | ||||
|             mHostnameVerifier = new BrowserCompatHostnameVerifier(); | ||||
|             mAdvancedSslSocketFactory = new AdvancedSslSocketFactory(sslContext, trustMgr, mHostnameVerifier); | ||||
|         } | ||||
|         return mAdvancedSslSocketFactory; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     private static String LOCAL_TRUSTSTORE_FILENAME = "knownServers.bks"; | ||||
|      | ||||
|     private static String LOCAL_TRUSTSTORE_PASSWORD = "password"; | ||||
| @ -184,16 +124,6 @@ public class NetworkUtils { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|      | ||||
|     static public MultiThreadedHttpConnectionManager getMultiThreadedConnManager() { | ||||
|         if (mConnManager == null) { | ||||
|             mConnManager = new MultiThreadedHttpConnectionManager(); | ||||
|             mConnManager.getParams().setDefaultMaxConnectionsPerHost(5); | ||||
|             mConnManager.getParams().setMaxTotalConnections(5); | ||||
|         } | ||||
|         return mConnManager; | ||||
|     } | ||||
| 
 | ||||
|     public static boolean isCertInKnownServersStore(Certificate cert, Context context)  | ||||
|     		throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { | ||||
|     	 | ||||
|  | ||||
| @ -27,7 +27,9 @@ | ||||
| 
 | ||||
| package com.owncloud.android.lib.common.network; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| 
 | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.http.HttpConstants; | ||||
| 
 | ||||
| import java.util.Arrays; | ||||
| 
 | ||||
| @ -108,7 +110,7 @@ public class RedirectionPath { | ||||
|      */ | ||||
|     public String getLastPermanentLocation() { | ||||
|         for (int i = mLastStatus; i >= 0; i--) { | ||||
|             if (mStatuses[i] == HttpStatus.SC_MOVED_PERMANENTLY && i <= mLastLocation) { | ||||
|             if (mStatuses[i] == HttpConstants.HTTP_MOVED_PERMANENTLY && i <= mLastLocation) { | ||||
|                 return mLocations[i]; | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -28,14 +28,15 @@ import android.accounts.Account; | ||||
| import android.accounts.AccountsException; | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException; | ||||
| import com.owncloud.android.lib.common.http.HttpConstants; | ||||
| import com.owncloud.android.lib.common.http.methods.HttpBaseMethod; | ||||
| import com.owncloud.android.lib.common.network.CertificateCombinedException; | ||||
| import com.owncloud.android.lib.common.utils.Log_OC; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.ConnectTimeoutException; | ||||
| import org.apache.commons.httpclient.HttpException; | ||||
| import org.apache.commons.httpclient.HttpMethod; | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import org.apache.jackrabbit.webdav.DavException; | ||||
| import org.json.JSONException; | ||||
| 
 | ||||
| @ -55,6 +56,7 @@ import java.util.Map; | ||||
| import javax.net.ssl.SSLException; | ||||
| import javax.net.ssl.SSLPeerUnverifiedException; | ||||
| 
 | ||||
| import at.bitfire.dav4android.exception.HttpException; | ||||
| import okhttp3.Headers; | ||||
| 
 | ||||
| 
 | ||||
| @ -180,9 +182,6 @@ public class RemoteOperationResult implements Serializable { | ||||
|         } else if (e instanceof SocketTimeoutException) { | ||||
|             mCode = ResultCode.TIMEOUT; | ||||
| 
 | ||||
|         } else if (e instanceof ConnectTimeoutException) { | ||||
|             mCode = ResultCode.TIMEOUT; | ||||
| 
 | ||||
|         } else if (e instanceof MalformedURLException) { | ||||
|             mCode = ResultCode.INCORRECT_ADDRESS; | ||||
| 
 | ||||
| @ -221,64 +220,6 @@ public class RemoteOperationResult implements Serializable { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Public constructor from separate elements of an HTTP or DAV response. | ||||
|      * | ||||
|      * To be used when the result needs to be interpreted from the response of an HTTP/DAV method. | ||||
|      * | ||||
|      * Determines a {@link ResultCode} from the already executed method received as a parameter. Generally, | ||||
|      * will depend on the HTTP code and HTTP response headers received. In some cases will inspect also the | ||||
|      * response body. | ||||
|      * | ||||
|      * @param success    The operation was considered successful or not. | ||||
|      * @param httpMethod HTTP/DAV method already executed which response will be examined to interpret the | ||||
|      *                   result. | ||||
|      */ | ||||
|     // TODO Delete this | ||||
|     public RemoteOperationResult(boolean success, HttpMethod httpMethod) throws IOException { | ||||
| //        this( | ||||
| //                success, | ||||
| //                httpMethod.getStatusCode(), | ||||
| //                httpMethod.getStatusText(), | ||||
| //                httpMethod.getResponseHeaders() | ||||
| //        ); | ||||
| 
 | ||||
|         if (mHttpCode == HttpStatus.SC_BAD_REQUEST) {   // 400 | ||||
| 
 | ||||
|             String bodyResponse = httpMethod.getResponseBodyAsString(); | ||||
|             // do not get for other HTTP codes!; could not be available | ||||
| 
 | ||||
|             if (bodyResponse != null && bodyResponse.length() > 0) { | ||||
|                 InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); | ||||
|                 InvalidCharacterExceptionParser xmlParser = new InvalidCharacterExceptionParser(); | ||||
|                 try { | ||||
|                     if (xmlParser.parseXMLResponse(is)) { | ||||
|                         mCode = ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER; | ||||
|                     } | ||||
| 
 | ||||
|                 } catch (Exception e) { | ||||
|                     Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); | ||||
|                     // mCode stays as set in this(success, httpCode, headers) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (mHttpCode == HttpStatus.SC_FORBIDDEN) {  // 403 | ||||
| 
 | ||||
|             parseErrorMessageAndSetCode(httpMethod, ResultCode.SPECIFIC_FORBIDDEN); | ||||
|         } | ||||
| 
 | ||||
|         if (mHttpCode == HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE) {    // 415 | ||||
| 
 | ||||
|             parseErrorMessageAndSetCode(httpMethod, ResultCode.SPECIFIC_UNSUPPORTED_MEDIA_TYPE); | ||||
|         } | ||||
| 
 | ||||
|         if (mHttpCode == HttpStatus.SC_SERVICE_UNAVAILABLE) {   // 503 | ||||
| 
 | ||||
|             parseErrorMessageAndSetCode(httpMethod, ResultCode.SPECIFIC_SERVICE_UNAVAILABLE); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Public constructor from separate elements of an HTTP or DAV response. | ||||
|      * | ||||
| @ -297,7 +238,7 @@ public class RemoteOperationResult implements Serializable { | ||||
|                 httpMethod.getResponseHeaders() | ||||
|         ); | ||||
| 
 | ||||
|         if (mHttpCode == HttpStatus.SC_BAD_REQUEST) {   // 400 | ||||
|         if (mHttpCode == HttpConstants.HTTP_FORBIDDEN) {   // 400 | ||||
|             String bodyResponse = httpMethod.getResponseBodyAsString(); | ||||
| 
 | ||||
|             // do not get for other HTTP codes!; could not be available | ||||
| @ -318,19 +259,19 @@ public class RemoteOperationResult implements Serializable { | ||||
| 
 | ||||
|         // before | ||||
|         switch (mHttpCode) { | ||||
|             case HttpStatus.SC_FORBIDDEN: | ||||
|             case HttpConstants.HTTP_FORBIDDEN: | ||||
|                 parseErrorMessageAndSetCode( | ||||
|                         httpMethod.getResponseBodyAsString(), | ||||
|                         ResultCode.SPECIFIC_FORBIDDEN | ||||
|                 ); | ||||
|                 break; | ||||
|             case HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE: | ||||
|             case HttpConstants.HTTP_UNSUPPORTED_MEDIA_TYPE: | ||||
|                 parseErrorMessageAndSetCode( | ||||
|                         httpMethod.getResponseBodyAsString(), | ||||
|                         ResultCode.SPECIFIC_UNSUPPORTED_MEDIA_TYPE | ||||
|                 ); | ||||
|                 break; | ||||
|             case HttpStatus.SC_SERVICE_UNAVAILABLE: | ||||
|             case HttpConstants.HTTP_SERVICE_UNAVAILABLE: | ||||
|                 parseErrorMessageAndSetCode( | ||||
|                         httpMethod.getResponseBodyAsString(), | ||||
|                         ResultCode.SPECIFIC_SERVICE_UNAVAILABLE | ||||
| @ -341,36 +282,6 @@ public class RemoteOperationResult implements Serializable { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Parse the error message included in the body response, if any, and set the specific result | ||||
|      * code | ||||
|      * @param httpMethod HTTP/DAV method already executed which response body will be parsed to get | ||||
|      *                   the specific error message | ||||
|      * @param resultCode specific result code | ||||
|      * @throws IOException | ||||
|      */ | ||||
|     private void parseErrorMessageAndSetCode(HttpMethod httpMethod, ResultCode resultCode) | ||||
|             throws IOException { | ||||
| 
 | ||||
|         String bodyResponse = httpMethod.getResponseBodyAsString(); | ||||
| 
 | ||||
|         if (bodyResponse != null && bodyResponse.length() > 0) { | ||||
|             InputStream is = new ByteArrayInputStream(bodyResponse.getBytes()); | ||||
|             ErrorMessageParser xmlParser = new ErrorMessageParser(); | ||||
|             try { | ||||
|                 String errorMessage = xmlParser.parseXMLResponse(is); | ||||
|                 if (errorMessage != "" && errorMessage != null) { | ||||
|                     mCode = resultCode; | ||||
|                     mHttpPhrase = errorMessage; | ||||
|                 } | ||||
|             } catch (Exception e) { | ||||
|                 Log_OC.w(TAG, "Error reading exception from server: " + e.getMessage()); | ||||
|                 // mCode stays as set in this(success, httpCode, headers) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * Parse the error message included in the body response, if any, and set the specific result | ||||
|      * code | ||||
| @ -403,8 +314,6 @@ public class RemoteOperationResult implements Serializable { | ||||
|      * To be used when the result needs to be interpreted from HTTP response elements that could come from | ||||
|      * different requests (WARNING: black magic, try to avoid). | ||||
|      * | ||||
|      * If all the fields come from the same HTTP/DAV response, {@link #RemoteOperationResult(boolean, HttpMethod)} | ||||
|      * should be used instead. | ||||
|      * | ||||
|      * Determines a {@link ResultCode} depending on the HTTP code and HTTP response headers received. | ||||
|      * | ||||
| @ -445,25 +354,25 @@ public class RemoteOperationResult implements Serializable { | ||||
| 
 | ||||
|         if (httpCode > 0) { | ||||
|             switch (httpCode) { | ||||
|                 case HttpStatus.SC_UNAUTHORIZED:                    // 401 | ||||
|                 case HttpConstants.HTTP_UNAUTHORIZED:                    // 401 | ||||
|                     mCode = ResultCode.UNAUTHORIZED; | ||||
|                     break; | ||||
|                 case HttpStatus.SC_FORBIDDEN:                       // 403 | ||||
|                 case HttpConstants.HTTP_FORBIDDEN:                       // 403 | ||||
|                     mCode = ResultCode.FORBIDDEN; | ||||
|                     break; | ||||
|                 case HttpStatus.SC_NOT_FOUND:                       // 404 | ||||
|                 case HttpConstants.HTTP_NOT_FOUND:                       // 404 | ||||
|                     mCode = ResultCode.FILE_NOT_FOUND; | ||||
|                     break; | ||||
|                 case HttpStatus.SC_CONFLICT:                        // 409 | ||||
|                 case HttpConstants.HTTP_CONFLICT:                        // 409 | ||||
|                     mCode = ResultCode.CONFLICT; | ||||
|                     break; | ||||
|                 case HttpStatus.SC_INTERNAL_SERVER_ERROR:           // 500 | ||||
|                 case HttpConstants.HTTP_INTERNAL_SERVER_ERROR:           // 500 | ||||
|                     mCode = ResultCode.INSTANCE_NOT_CONFIGURED;     // assuming too much... | ||||
|                     break; | ||||
|                 case HttpStatus.SC_SERVICE_UNAVAILABLE:             // 503 | ||||
|                 case HttpConstants.HTTP_SERVICE_UNAVAILABLE:             // 503 | ||||
|                     mCode = ResultCode.SERVICE_UNAVAILABLE; | ||||
|                     break; | ||||
|                 case HttpStatus.SC_INSUFFICIENT_STORAGE:            // 507 | ||||
|                 case HttpConstants.HTTP_INSUFFICIENT_STORAGE:            // 507 | ||||
|                     mCode = ResultCode.QUOTA_EXCEEDED;              // surprise! | ||||
|                     break; | ||||
|                 default: | ||||
| @ -547,9 +456,6 @@ public class RemoteOperationResult implements Serializable { | ||||
|             } else if (mException instanceof SocketTimeoutException) { | ||||
|                 return "Socket timeout exception"; | ||||
| 
 | ||||
|             } else if (mException instanceof ConnectTimeoutException) { | ||||
|                 return "Connect timeout exception"; | ||||
| 
 | ||||
|             } else if (mException instanceof MalformedURLException) { | ||||
|                 return "Malformed URL exception"; | ||||
| 
 | ||||
| @ -628,7 +534,7 @@ public class RemoteOperationResult implements Serializable { | ||||
|     } | ||||
| 
 | ||||
|     public boolean isServerFail() { | ||||
|         return (mHttpCode >= HttpStatus.SC_INTERNAL_SERVER_ERROR); | ||||
|         return (mHttpCode >= HttpConstants.HTTP_INTERNAL_SERVER_ERROR); | ||||
|     } | ||||
| 
 | ||||
|     public boolean isException() { | ||||
|  | ||||
| @ -117,7 +117,7 @@ public class GetRemoteStatusOperation extends RemoteOperation { | ||||
| //                get = new GetMethod(redirectedLocation); | ||||
| //                status = client.executeRequest(get, TRY_CONNECTION_TIMEOUT, TRY_CONNECTION_TIMEOUT); | ||||
| //                mLatestResult = new RemoteOperationResult( | ||||
| //                    (status == HttpStatus.SC_OK), | ||||
| //                    (status == HttpConstants.HTTP_OK), | ||||
| //                    get | ||||
| //                ); | ||||
| //                redirectedLocation = mLatestResult.getRedirectedLocation(); | ||||
|  | ||||
| @ -26,6 +26,7 @@ | ||||
| package com.owncloud.android.lib.resources.users; | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.OwnCloudClient; | ||||
| import com.owncloud.android.lib.common.http.HttpConstants; | ||||
| import com.owncloud.android.lib.common.http.HttpUtils; | ||||
| import com.owncloud.android.lib.common.http.methods.nonwebdav.GetMethod; | ||||
| import com.owncloud.android.lib.common.network.WebdavUtils; | ||||
| @ -33,7 +34,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperation; | ||||
| import com.owncloud.android.lib.common.operations.RemoteOperationResult; | ||||
| import com.owncloud.android.lib.common.utils.Log_OC; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| 
 | ||||
| import java.io.BufferedInputStream; | ||||
| import java.io.ByteArrayOutputStream; | ||||
| @ -182,7 +182,7 @@ public class GetRemoteUserAvatarOperation extends RemoteOperation { | ||||
|     } | ||||
| 
 | ||||
|     private boolean isSuccess(int status) { | ||||
|         return (status == HttpStatus.SC_OK); | ||||
|         return (status == HttpConstants.HTTP_OK); | ||||
|     } | ||||
| 
 | ||||
|     public static class ResultData { | ||||
|  | ||||
| @ -41,12 +41,6 @@ import javax.net.ssl.TrustManager; | ||||
| import javax.net.ssl.TrustManagerFactory; | ||||
| import javax.net.ssl.X509TrustManager; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.ConnectTimeoutException; | ||||
| import org.apache.commons.httpclient.params.HttpConnectionParams; | ||||
| import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.network.AdvancedSslSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * SelfSignedConfidentSslSocketFactory allows to create SSL {@link Socket}s  | ||||
|  | ||||
| @ -30,8 +30,8 @@ import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import android.app.Activity; | ||||
| import android.content.Context; | ||||
|  | ||||
| @ -42,9 +42,9 @@ import com.owncloud.android.lib.test_project.TestActivity; | ||||
| 
 | ||||
| import junit.framework.AssertionFailedError; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import java.io.File; | ||||
| import java.security.GeneralSecurityException; | ||||
| @ -373,7 +373,7 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
|                 false | ||||
|         ); | ||||
|         result = copyOperation.execute(mClient); | ||||
|         assertTrue(result.getHttpCode() == HttpStatus.SC_CONFLICT); | ||||
|         assertTrue(result.getHttpCode() == HttpConstants.HTTP_CONFLICT); | ||||
| 
 | ||||
|         // target location (renaming) has invalid characters | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|  | ||||
| @ -29,8 +29,8 @@ import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import junit.framework.AssertionFailedError; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.net.Uri; | ||||
|  | ||||
| @ -29,9 +29,9 @@ import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import junit.framework.AssertionFailedError; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import org.json.JSONException; | ||||
| import org.json.JSONObject; | ||||
| 
 | ||||
| @ -184,11 +184,11 @@ public class GetShareesTest extends RemoteTest { | ||||
| 		// search for sharees including wrong page values | ||||
| 		getShareesOperation = new GetRemoteShareesOperation("a", 0, 50); | ||||
| 		result = getShareesOperation.execute(mClient); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST); | ||||
| 		 | ||||
| 		getShareesOperation = new GetRemoteShareesOperation("a", 1, 0); | ||||
| 		result = getShareesOperation.execute(mClient); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| @ -237,11 +237,11 @@ public class GetShareesTest extends RemoteTest { | ||||
| 		// search for sharees including wrong page values | ||||
| 		getShareesOperation = new GetRemoteShareesOperation("@", 0, 50); | ||||
| 		result = getShareesOperation.execute(mClient); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST); | ||||
| 		 | ||||
| 		getShareesOperation = new GetRemoteShareesOperation("@", 1, 0); | ||||
| 		result = getShareesOperation.execute(mClient); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpStatus.SC_BAD_REQUEST); | ||||
| 		assertTrue(!result.isSuccess() && result.getHttpCode() == HttpConstants.HTTP_BAD_REQUEST); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
|  | ||||
| @ -31,7 +31,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult; | ||||
| import com.owncloud.android.lib.resources.users.GetRemoteUserAvatarOperation.ResultData; | ||||
| import com.owncloud.android.lib.test_project.TestActivity; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Class to test {@link GetRemoteUserAvatarOperation} | ||||
| @ -81,7 +81,7 @@ public class GetUserAvatarTest extends RemoteTest { | ||||
|         // request again, with the just received etag | ||||
|         result = mActivity.getUserAvatar(AVATAR_DIMENSION, etag); | ||||
|         assertFalse(result.isSuccess()); | ||||
|         assertTrue(result.getHttpCode() == HttpStatus.SC_NOT_MODIFIED); | ||||
|         assertTrue(result.getHttpCode() == HttpConstants.HTTP_NOT_MODIFIED); | ||||
|     } | ||||
|     */ | ||||
| 
 | ||||
|  | ||||
| @ -29,9 +29,9 @@ import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import junit.framework.AssertionFailedError; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import com.owncloud.android.lib.common.OwnCloudClient; | ||||
| import com.owncloud.android.lib.common.OwnCloudClientFactory; | ||||
| @ -373,7 +373,7 @@ public class MoveFileTest extends RemoteTest { | ||||
| 				false | ||||
| 		); | ||||
| 		result = moveOperation.execute(mClient); | ||||
| 		assertTrue(result.getHttpCode() == HttpStatus.SC_CONFLICT); | ||||
| 		assertTrue(result.getHttpCode() == HttpConstants.HTTP_CONFLICT); | ||||
| 
 | ||||
| 		// target location (renaming) has invalid characters | ||||
| 		moveOperation = new MoveRemoteFileOperation( | ||||
|  | ||||
| @ -27,12 +27,12 @@ import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.net.SocketTimeoutException; | ||||
| import java.security.GeneralSecurityException; | ||||
| import org.apache.commons.httpclient.ConnectTimeoutException; | ||||
| import org.apache.commons.httpclient.HttpException; | ||||
| import org.apache.commons.httpclient.methods.HeadMethod; | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| import org.apache.commons.httpclient.HttpStatus; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import org.apache.jackrabbit.webdav.DavConstants; | ||||
| import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; | ||||
| 
 | ||||
| @ -314,7 +314,7 @@ public class OwnCloudClientTest extends AndroidTestCase { | ||||
| 					DavConstants.DEPTH_0); | ||||
| 			int status = client.executeMethod(propfind); | ||||
| 			assertEquals("WebDAV request did not work on WebDAV URI",  | ||||
| 					HttpStatus.SC_MULTI_STATUS, status); | ||||
| 					HttpConstants.HTTP_MULTI_STATUS, status); | ||||
| 			 | ||||
|         } catch (IOException e) { | ||||
|         	Log.e(TAG, "Exception in PROPFIND method execution", e); | ||||
|  | ||||
| @ -25,8 +25,8 @@ package com.owncloud.android.lib.test_project.test; | ||||
| 
 | ||||
| import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import android.net.Uri; | ||||
| import android.test.AndroidTestCase; | ||||
|  | ||||
| @ -25,8 +25,8 @@ package com.owncloud.android.lib.test_project.test; | ||||
| 
 | ||||
| import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import android.net.Uri; | ||||
| import android.test.AndroidTestCase; | ||||
|  | ||||
| @ -31,8 +31,8 @@ import java.security.GeneralSecurityException; | ||||
| 
 | ||||
| import junit.framework.AssertionFailedError; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.net.Uri; | ||||
|  | ||||
| @ -32,8 +32,8 @@ import java.util.Calendar; | ||||
| 
 | ||||
| import junit.framework.AssertionFailedError; | ||||
| 
 | ||||
| import org.apache.commons.httpclient.protocol.Protocol; | ||||
| import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.net.Uri; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user