mirror of
https://github.com/unmojang/authlib-injector.git
synced 2025-10-03 08:11:04 -04:00
Remove unnecessary connection.connect()/disconnect()
This commit is contained in:
parent
1148e0c6bc
commit
c297c4debc
@ -160,7 +160,6 @@ public class URLProcessor {
|
|||||||
conn.setRequestMethod(method);
|
conn.setRequestMethod(method);
|
||||||
conn.setDoOutput(clientIn != null);
|
conn.setDoOutput(clientIn != null);
|
||||||
requestHeaders.forEach(conn::setRequestProperty);
|
requestHeaders.forEach(conn::setRequestProperty);
|
||||||
conn.connect();
|
|
||||||
|
|
||||||
if (clientIn != null) {
|
if (clientIn != null) {
|
||||||
try (OutputStream upstreamOut = conn.getOutputStream()) {
|
try (OutputStream upstreamOut = conn.getOutputStream()) {
|
||||||
|
@ -25,17 +25,12 @@ public final class IOUtils {
|
|||||||
conn.setRequestProperty("Content-Type", contentType);
|
conn.setRequestProperty("Content-Type", contentType);
|
||||||
conn.setRequestProperty("Content-Length", String.valueOf(payload.length));
|
conn.setRequestProperty("Content-Length", String.valueOf(payload.length));
|
||||||
conn.setDoOutput(true);
|
conn.setDoOutput(true);
|
||||||
try {
|
|
||||||
conn.connect();
|
|
||||||
try (OutputStream out = conn.getOutputStream()) {
|
try (OutputStream out = conn.getOutputStream()) {
|
||||||
out.write(payload);
|
out.write(payload);
|
||||||
}
|
}
|
||||||
try (InputStream in = conn.getInputStream()) {
|
try (InputStream in = conn.getInputStream()) {
|
||||||
return asBytes(in);
|
return asBytes(in);
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
conn.disconnect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] asBytes(InputStream in) throws IOException {
|
public static byte[] asBytes(InputStream in) throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user