WebClient webClient = WebClient.create();
ResponseEntity<String> res = webClient
.get()
.uri("http:// 1 中的 url")
.header("a", "\u007F") // code point 127
.retrieve().toEntity(String.class).block();
System.out.println(res.getStatusCodeValue());
System.out.println(res.getBody());
另一个问题,如果换成文
这些,接收到的会变成 ?
(code point 63) , 想问下这个又是哪里对它做了处理
1
yolee599 2023-12-07 18:21:50 +08:00 1
大概率是 print 的问题,你直接打印 hex 应该是对得上的
|
2
JinTianYi456 OP @yolee599 #1 (一)感谢错了 (二)我用的是 code point 输出
|
3
guyeu 2023-12-08 00:17:46 +08:00 via iPhone
According to RFC2616, only ascii-printable characters are valid for HTTP header values.
|
4
JinTianYi456 OP @guyeu #3 看过类似的 spec ,但我问的是源码处理的地方。(我要找到它 报错/重写 的地方)
类似这样: https://github.com/square/okhttp/blob/okhttp_3.14.x/okhttp/src/main/java/okhttp3/Headers.java#L279 |
5
JinTianYi456 OP @guyeu #3 Thanks, but that spec was obsoleted several times, ultimately ending up with https://datatracker.ietf.org/doc/html/rfc9112
|