This commit is contained in:
@@ -1676,6 +1676,7 @@ public final class Utility {
|
||||
|
||||
public static ByteArrayOutputStream remoteHttpContent(SSLContext ctx, String method, String url, int timeout, Map<String, String> headers, String body) throws IOException {
|
||||
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
|
||||
try {
|
||||
conn.setConnectTimeout(timeout > 0 ? timeout : 3000);
|
||||
conn.setReadTimeout(timeout > 0 ? timeout : 3000);
|
||||
if (conn instanceof HttpsURLConnection) {
|
||||
@@ -1709,8 +1710,10 @@ public final class Utility {
|
||||
while ((pos = in.read(bytes)) != -1) {
|
||||
out.write(bytes, 0, pos);
|
||||
}
|
||||
conn.disconnect();
|
||||
return out;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public static String read(InputStream in) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user