Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2016-10-13 06:27:22 -0400
committerMatthias Sohn2016-10-13 06:29:45 -0400
commitb8e3e194e3200adfb0c64a4d79b9bfbb0837b00c (patch)
tree7ccaf478b33b5c7144d069c23a042675a908de09 /org.eclipse.jgit.http.apache/src
parent32c89d2844ede674950799b8d842fd27a09962ae (diff)
downloadjgit-b8e3e194e3200adfb0c64a4d79b9bfbb0837b00c.tar.gz
jgit-b8e3e194e3200adfb0c64a4d79b9bfbb0837b00c.tar.xz
jgit-b8e3e194e3200adfb0c64a4d79b9bfbb0837b00c.zip
HttpClientConnection: Register connection socket factory for http
It is necessary to register a socket connection factory to prevent the "http protocol is not supported" error when connecting over a proxy. Change-Id: Iedf554acef841f52c1f2e3401ef0a0583ac5253b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.http.apache/src')
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
index 6543bf6610..c6e557aba4 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
+++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
@@ -89,6 +89,7 @@ import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.X509HostnameVerifier;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -157,7 +158,9 @@ public class HttpClientConnection implements HttpConnection {
clientBuilder.setSSLSocketFactory(sslConnectionFactory);
Registry<ConnectionSocketFactory> registry = RegistryBuilder
.<ConnectionSocketFactory> create()
- .register("https", sslConnectionFactory).build();
+ .register("https", sslConnectionFactory)
+ .register("http", PlainConnectionSocketFactory.INSTANCE)
+ .build();
clientBuilder.setConnectionManager(
new BasicHttpClientConnectionManager(registry));
}

Back to the top