-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3429 from vishalduggal/timob-11728
[TIMOB-11728][TIMOB-11697] New properties for HTTPClient on iOS
- Loading branch information
Showing
5 changed files
with
163 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
android/modules/network/src/java/ti/modules/titanium/network/TiSocketFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2012 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
package ti.modules.titanium.network; | ||
|
||
import java.io.IOException; | ||
import java.net.Socket; | ||
import java.net.UnknownHostException; | ||
import java.security.KeyManagementException; | ||
import java.security.KeyStoreException; | ||
import java.security.NoSuchAlgorithmException; | ||
import java.security.UnrecoverableKeyException; | ||
|
||
import javax.net.ssl.KeyManager; | ||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.TrustManager; | ||
|
||
import org.apache.http.conn.ssl.SSLSocketFactory; | ||
|
||
public class TiSocketFactory extends SSLSocketFactory { | ||
|
||
private SSLContext sslContext = SSLContext.getInstance("TLS"); | ||
|
||
public TiSocketFactory(KeyManager[] keyManagers, TrustManager[] trustManagers) throws NoSuchAlgorithmException, | ||
KeyManagementException, KeyStoreException, UnrecoverableKeyException | ||
{ | ||
super(null,null,null,null,null,null); | ||
sslContext.init(keyManagers, trustManagers, null); | ||
} | ||
|
||
@Override | ||
public Socket createSocket() throws IOException | ||
{ | ||
return sslContext.getSocketFactory().createSocket(); | ||
} | ||
|
||
@Override | ||
public Socket createSocket (Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException | ||
{ | ||
return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); | ||
} | ||
|
||
@Override | ||
public boolean isSecure(Socket socket) throws IllegalArgumentException | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters