fix(security): 修复XSS+硬编码IP+资源泄露

This commit is contained in:
2026-06-18 21:31:14 +08:00
parent 8afeb2e4d9
commit ea0c3b80c3

View File

@@ -33,15 +33,19 @@ public class HttpRequestGetJson extends HttpReques {
String data = url + json;
URL apiURL = new URL(data);
HttpURLConnection connection = (HttpURLConnection) apiURL.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type","application/json");
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
StringBuffer response = new StringBuffer();
while ((line = reader.readLine()) != null){
response.append(line);
try {
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type","application/json");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String line;
StringBuffer response = new StringBuffer();
while ((line = reader.readLine()) != null){
response.append(line);
}
}
} finally {
connection.disconnect();
}
reader.close();
} catch (MalformedURLException e) {
logger.error("CQ_DATA_LOG:{}",e.getMessage());
} catch (IOException e) {