首頁 > java > tomcat > > 正文

HTTP header parsing errors— defined in RFC 7230 and RFC 3986

發布人:zhoulujun    點擊:

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

之前把順豐金融官網改版成java,運營一年后,今天突然跳出bug了。

只知道請求參數要做限制,卻forget  這么fixed了?——三四年不摸java,就后遺癥一大堆

自己挖的坑死命也得填啊。


May 03, 2018 8:06:33 PM org.apache.coyote.http11.AbstractHttp11Processor process

INFO: 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.InternalNioInputBuffer.parseRequestLine(InternalNioInputBuffer.java:317)

        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1000)

        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)

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

        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715)

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

百度一搜,啥都沒有

Screen Shot 2018-05-08 at 10.23.57.png

心理詛咒下GFW和坑爹的內網防火墻。接上4G找谷歌。

總結下在不升級tomcat到8.0以上的情況下

Add this line in your catalina.properties

tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}

加上了,關鍵是我都不知道,怎么寫測試用例來測試這個!


https://stackoverflow.com/questions/41053653/tomcat-8-is-not-able-to-handle-get-request-with-in-query-parameters

https://issues.alfresco.com/jira/browse/ALF-21878