Invalid character found in method name. HTTP method names must be tokens

﹏ヽ暗。殇╰゛Y 2023-06-10 06:25 102阅读 0赞

项目中用到了websocket建立双向长连接,遇到如下bug:

  1. INFO [http-nio-80-exec-4461] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
  2. Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
  3. java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
  4. at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:233)
  5. at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017)
  6. at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
  7. at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
  8. at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
  9. at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  10. at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  11. at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  12. at java.lang.Thread.run(Unknown Source)

最后发现是因为我在写websocket url的时候,写的是wss,wss默认使用https,但是我在连接过程中,并没有使用到ca证书,因此可以通过http,也就是用ws建立连接

发表评论

表情:
评论列表 (有 0 条评论,102人围观)

还没有评论,来说两句吧...

相关阅读