猿问

如何修复tomcat org.apache.tomcat.util.http.parser.

我的请求URL中有字符[和],项目部署在Tomcat8.5.33上。当我发布请求时会发生一些异常。


20-Sep-2018 10:55:36.494 WARNING [http-nio-8075-exec-2] org.apache.tomcat.util.http.parser.HttpParser.<clinit> Character [[] is not allowed and will continue to be rejected.

20-Sep-2018 10:55:36.494 WARNING [http-nio-8075-exec-2] org.apache.tomcat.util.http.parser.HttpParser.<clinit> Character []] is not allowed and will continue to be rejected.

20-Sep-2018 10:56:07.083 INFO [http-nio-8075-exec-10] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

 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:479)

    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684)

    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)

    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)

    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:748)



胡子哥哥
浏览 1055回答 2
2回答

qq_花开花谢_0

在我的请求 URL 中有字符[和]....这是真正的问题。您正在向您的服务器发送一个带有无效 URL 的请求。有效的 URL 不能包含[和]...,主机部分的 IP 文字除外。在所有其他情况下,它们必须是 %-escaped。在正确的解决方法是修复你的URL和/或生成它们在客户端软件。Tomcat 只是强制执行 URL / URI 规范中的规则……这些规则在过去 20 多年左右的时间里一直存在于规范中。
随时随地看视频慕课网APP

相关分类

Java
我要回答