fix(security): 修复XSS+硬编码IP+资源泄露
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user