From: Tobias Brunner Date: Fri, 22 Jul 2022 09:43:56 +0000 (+0200) Subject: android: Prevent FD leak from HttpURLConnection X-Git-Tag: 5.9.8rc1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7433f1672a49325eb4e8f2362248828911173da0;p=thirdparty%2Fstrongswan.git android: Prevent FD leak from HttpURLConnection The default is apparently "Connection: keep-alive", which somehow keeps the socket around, which leaks file descriptors with every connection that fetches OCSP and/or CRLs. Over time that could result in the number of FDs reaching a limit e.g. imposed by FD_SET(). Closes strongswan/strongswan#1160 --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/SimpleFetcher.java b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/SimpleFetcher.java index ca756403db..7679cd4570 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/SimpleFetcher.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/SimpleFetcher.java @@ -58,6 +58,7 @@ public class SimpleFetcher HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(10000); conn.setReadTimeout(10000); + conn.setRequestProperty("Connection", "close"); try { if (contentType != null)