From b3a9b0dab081892ba980ae52913e6d103e9ef805 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 4 Sep 2015 15:59:16 +0200 Subject: Apply short timeouts to http requests --- src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java b/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java index 4dfdb39..3d9d801 100644 --- a/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java +++ b/src/main/java/edu/kit/scc/dei/ecplean/ECPAuthenticator.java @@ -14,6 +14,7 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.params.HttpParams; import org.apache.http.util.EntityUtils; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -32,6 +33,11 @@ public class ECPAuthenticator extends ECPAuthenticatorBase { public ECPAuthenticator(String username, String password, URI idpEcpEndpoint, URI spUrl) { this(new DefaultHttpClient(), username, password, idpEcpEndpoint, spUrl); + HttpParams params = client.getParams(); + params.setParameter("http.socket.timeout", 6000); + params.setParameter("http.connection.timeout", 3000); + params.setParameter("http.connection-manager.timeout", new Long(3000)); + params.setParameter("http.protocol.head-body-timeout", 5000); } public void authenticate() throws ECPAuthenticationException { -- cgit v1.2.3-55-g7522