fix(security): 修复XSS+硬编码IP+资源泄露
This commit is contained in:
@@ -33,15 +33,19 @@ public class HttpRequestGetJson extends HttpReques {
|
|||||||
String data = url + json;
|
String data = url + json;
|
||||||
URL apiURL = new URL(data);
|
URL apiURL = new URL(data);
|
||||||
HttpURLConnection connection = (HttpURLConnection) apiURL.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) apiURL.openConnection();
|
||||||
connection.setRequestMethod("GET");
|
try {
|
||||||
connection.setRequestProperty("Content-Type","application/json");
|
connection.setRequestMethod("GET");
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
connection.setRequestProperty("Content-Type","application/json");
|
||||||
String line;
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||||
StringBuffer response = new StringBuffer();
|
String line;
|
||||||
while ((line = reader.readLine()) != null){
|
StringBuffer response = new StringBuffer();
|
||||||
response.append(line);
|
while ((line = reader.readLine()) != null){
|
||||||
|
response.append(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
reader.close();
|
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
logger.error("CQ_DATA_LOG:{}",e.getMessage());
|
logger.error("CQ_DATA_LOG:{}",e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user