]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Prevent FD leak from HttpURLConnection
authorTobias Brunner <tobias@strongswan.org>
Fri, 22 Jul 2022 09:43:56 +0000 (11:43 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 21 Sep 2022 13:15:18 +0000 (15:15 +0200)
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

src/frontends/android/app/src/main/java/org/strongswan/android/logic/SimpleFetcher.java

index ca756403dbddeb9b9ee25853cdf68b4fa0bd8277..7679cd4570fd6b61e6206131d1855e7327116374 100644 (file)
@@ -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)