1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-24 12:16:28 +01:00

Add User-Agent to news page HTTP requests

Cloudflare, and some other MITM proxies consider the default Java HttpURLConnection
from Java 1.8 to be an invalid, unsafe request and reject it. This leads to CF returning a
403 on request. This commit adds the same User-Agent that's applied to the other calls, so
that those that front their SKMC launcher news page with Cloudflare can have successful
page loads.
This commit is contained in:
David Lohle 2021-02-18 21:30:04 -05:00
parent 7803242ffa
commit 4703b0dede

View File

@ -250,6 +250,7 @@ public final class WebpagePanel extends JPanel {
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setUseCaches(false);
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Java) SKMCLauncher");
conn.setDoInput(true);
conn.setDoOutput(false);
conn.setReadTimeout(5000);