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
This commit is contained in:
Tobias Brunner 2022-07-22 11:43:56 +02:00
parent ef68a7056b
commit 7433f1672a

View 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)