restricted header 허용

main
이범준 2 months ago
parent 5ec27d9665
commit 9446cff68d

@ -3,6 +3,8 @@ package cokr.xit.fims;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@ -18,6 +20,8 @@ public class MainApplication extends SpringBootApplicationBridge {
public static void main(String[] args) { public static void main(String[] args) {
allowRestrictedHeaders();
try { try {
BufferedReader in = new BufferedReader(new InputStreamReader(new ClassPathResource("sgg.txt").getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(new ClassPathResource("sgg.txt").getInputStream()));
String sgg = in.readLine(); String sgg = in.readLine();
@ -29,4 +33,24 @@ public class MainApplication extends SpringBootApplicationBridge {
SpringApplication.run(MainApplication.class, args); SpringApplication.run(MainApplication.class, args);
} }
public static void allowRestrictedHeaders() {
String allowRestrictedHeaders = System.getProperty("jdk.httpclient.allowRestrictedHeaders");
if(allowRestrictedHeaders == null) {
allowRestrictedHeaders = "";
}
List<String> allowRestrictedHeadersArr = Arrays.asList(allowRestrictedHeaders.split(","));
String[] items = {"connection","host","content-length","expect","upgrade"};
for(String item : items) {
if(!allowRestrictedHeadersArr.contains(item)) {
if(!allowRestrictedHeaders.equals("")) {
allowRestrictedHeaders += ",";
}
allowRestrictedHeaders += item;
}
}
System.setProperty("jdk.httpclient.allowRestrictedHeaders", allowRestrictedHeaders);
}
} }

Loading…
Cancel
Save