Skip to content

Commit 7601d49

Browse files
gitchenjhklboke
authored andcommitted
修复:允许URL中出现|{}等字符,解决The valid characters are defined in RFC 7230 and RFC 3986问题
1 parent 1edf4d8 commit 7601d49

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

jodconverter-web/src/main/java/cn/keking/FilePreviewApplication.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55
import org.springframework.context.annotation.ComponentScan;
66
import org.springframework.scheduling.annotation.EnableScheduling;
7-
import java.util.Properties;
87

98
@SpringBootApplication
109
@EnableScheduling
1110
@ComponentScan(value = "cn.keking.*")
1211
public class FilePreviewApplication {
1312
public static void main(String[] args) {
14-
Properties properties = System.getProperties();
15-
System.out.println(properties.get("user.dir"));
1613
SpringApplication.run(FilePreviewApplication.class, args);
1714
}
1815
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package cn.keking.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
/**
7+
* @author chenjh
8+
* @since 2020/5/18 13:41
9+
*/
10+
@Configuration
11+
public class RFCConfig {
12+
13+
@Bean
14+
public Boolean setRequestTargetAllow() {
15+
// RFC 7230,RFC 3986规范不允许url相关特殊字符,手动指定Tomcat url允许特殊符号, 如{}做入参,其他符号按需添加。见tomcat的HttpParser源码。
16+
System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "|{}");
17+
return true;
18+
}
19+
}

0 commit comments

Comments
 (0)