原始url:http://localhost/r?content=养车真不容易啊%20保险保养太费钱了[捂脸]
URL 编码后url:http://localhost/r?content=%E5%85%BB%E8%BD%A6%E7%9C%9F%E4%B8%8D%E5%AE%B9%E6%98%93%E5%95%8A%20%E4%BF%9D%E9%99%A9%E4%BF%9D%E5%85%BB%E5%A4%AA%E8%B4%B9%E9%92%B1%E4%BA%86[%E6%8D%82%E8%84%B8]
注意看,捂脸两边的中括号 [] 没有被编码,这会导致请求到tomcat时,字符校验报错:
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:468) ~[tomcat-embed-core-9.0.27.jar:9.0.27]