问题:HTTP method names must be tokens

文章讲述了在处理HTTP请求时遇到的解析错误,原因是请求头中的HTTP方法名包含非token字符。解决方法是确保使用正确的协议(HTTP而非HTTPS)进行调用。
摘要由CSDN通过智能技术生成

问题:HTTP method names must be tokens

2023-12-04T09:43:16.654+08:00  INFO 7808 --- [nio-6600-exec-1] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x030x000xc70x010x000x000xc30x030x03em/70xfb0xfdE0x00|<iI0x881X_$0xbf0xe50x82Q0xbf0xc20xed0xbcG0x100x820xcb0x920x00%0x000x00V0xc0$0xc0(0x00=0xc0&0xc0*0x00k0x00j0xc00x0a0xc00x140x0050xc00x050xc00x0f0x0090x0080xc0#0xc0'0x00<0xc0%0xc0)0x00g0x00@0xc00x090xc00x130x00/0xc00x040xc00x0e0x0030x0020xc0,0xc0+0xc000x000x9d0xc0.0xc020x000x9f0x000xa30xc0/0x000x9c0xc0-0xc010x000x9e0x000xa20x000xff0x010x000x00D0x000x0a0x000x160x000x140x000x170x000x180x000x190x000x090x000x0a0x000x0b0x000x0c0x000x0d0x000x0e0x000x160x000x0b0x000x020x010x000x000x0d0x000x1c0x000x1a0x060x030x060x010x050x030x050x010x040x030x040x010x040x020x030x030x030x010x030x020x020x030x020x010x020x020x000x170x000x00...]. HTTP method names must be tokens
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:407) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:264) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:894) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1740) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.11.jar:10.1.11]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

在这里插入图片描述
分析原因:

http的接口请求使用了https的协议

解决方案:

调用时使用http进行

HTTP 方法名称必须是令牌。令牌是由特定字符组成的字符串,用于表示请求方法,例如GET和POST。这是HTTP协议的要求,如果在请求行中使用了无效的字符或特殊字符作为方法名称,就会导致报错。 在报错信息中,java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens,说明在解析请求行时发现了无效的字符。 解决该问题的方法是确保请求行中的方法名称只包含合法的字符,并且没有使用特殊字符或无法识别的中文字符。同时,还需要检查请求行中的其他部分,包括URL和协议名称及版本号,确保没有填错或使用了不合法的字符。 这个错误虽然对程序运行没有影响,但会在日志中出现不重要的异常信息,可能会对以后查看日志定位问题造成一定的影响。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Invalid character found in method name. HTTP method names must be tokens](https://blog.csdn.net/weixin_43139644/article/details/94431820)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [解决 Invalid character found in method name. HTTP method names must be tokens 异常信息](https://blog.csdn.net/AntKengElephant/article/details/113342720)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值