Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix https problems

  • Loading branch information...
commit 13ec6197a91856417525ab746f818cdd84a2517d 1 parent 0aa4516
@nobnago authored
View
6 src/com/byarger/exchangeit/EasySSLSocketFactory.java
@@ -31,7 +31,6 @@
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.scheme.LayeredSocketFactory;
-import org.apache.http.conn.scheme.SocketFactory;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
@@ -44,8 +43,7 @@
* $
* @since 1.2.3
*/
-public class EasySSLSocketFactory implements SocketFactory,
- LayeredSocketFactory {
+public class EasySSLSocketFactory implements LayeredSocketFactory {
private SSLContext sslcontext = null;
@@ -117,7 +115,7 @@ public boolean isSecure(Socket socket) throws IllegalArgumentException {
*/
public Socket createSocket(Socket socket, String host, int port,
boolean autoClose) throws IOException, UnknownHostException {
- return getSSLContext().getSocketFactory().createSocket();
+ return getSSLContext().getSocketFactory().createSocket(socket, host, port, autoClose);
}
// -------------------------------------------------------------------
View
6 src/com/ichi2/libanki/sync/BasicHttpSyncer.java
@@ -140,17 +140,17 @@ public HttpResponse req(String method, InputStream fobj, int comp, boolean hkey)
httpPost.setEntity(entity);
httpPost.setHeader("Content-type", "multipart/form-data; boundary=" + BOUNDARY);
- // https
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 443));
+
HttpParams params = new BasicHttpParams();
params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30));
params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
- HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
+ HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
+
ClientConnectionManager cm = new SingleClientConnManager(params, schemeRegistry);
-
DefaultHttpClient httpClient = new DefaultHttpClient(cm, params);
return httpClient.execute(httpPost);
} catch (UnsupportedEncodingException e) {
Please sign in to comment.
Something went wrong with that request. Please try again.