chb*_*chb 7 java spring netty spring-boot webflux
我目前正在使用 spring boot webflux 进行开发。我正在使用 websocket 客户端和 API 客户端,但此错误在部署后几个小时发生。我无法弄清楚这个错误是从哪里来的。这个问题从何而来?
错误日志如下。
[reactor-http-epoll-2] r.n.http.server.HttpServerOperations : [9c0c3ede, L:/172.25.0.8:8080 - R:/94.232.43.63:34534] Decoding failed: DefaultFullHttpRequest(decodeResult: failure(java.lang.IllegalArgumentException: text is empty (possibly HTTP/0.9)), version: HTTP/1.0, content: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 0, cap: 0))
GET /bad-request HTTP/1.0 :
java.lang.IllegalArgumentException: text is empty (possibly HTTP/0.9)
at io.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:65) ~[netty-codec-http-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:126) ~[netty-codec-http-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.http.HttpObjectDecoder.decode(HttpObjectDecoder.java:273) ~[netty-codec-http-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.http.HttpServerCodec$HttpServerRequestDecoder.decode(HttpServerCodec.java:140) ~[netty-codec-http-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507) ~[netty-codec-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446) ~[netty-codec-4.1.72.Final.jar:4.1.72.Final]
Run Code Online (Sandbox Code Playgroud)
有时,还会发现破损的字符以及“文本为空”这句话。如果这是编码问题,我应该如何设置?
Rad*_*nov 10
您可能只运行 spring boot 应用程序http,然后通过https(或者您的浏览器重定向到 https)点击它,因此 http 版本无法正确解析。您还应该:
java.lang.IllegalArgumentException: invalid version format: S\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbdJZ\n at io.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:116) ~[netty-codec-http-4.1.73.Final.jar!/:4.1.73.Final]\n\nRun Code Online (Sandbox Code Playgroud)\n请确保正确的浏览器/请求/协议/编码。
\n| 归档时间: |
|
| 查看次数: |
8049 次 |
| 最近记录: |