-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
component/need-triageNeed maintainers to triageNeed maintainers to triagetype/need-triageNeed maintainers to triageNeed maintainers to triage
Description
Pre-check
- I am sure that all the content I provide is in English.
Search before asking
- I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
Dubbo java 3.3.3 JDK 17
Steps to reproduce this issue
When the HTTP header Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__
, a parsing exception will occur.
java.nio.charset.IllegalCharsetNameException: utf-8; boundary=__X_PAW_BOUNDARY__
at java.base/java.nio.charset.Charset.checkName(Charset.java:328) ~[na:na]
at java.base/java.nio.charset.Charset.lookup2(Charset.java:512) ~[na:na]
at java.base/java.nio.charset.Charset.lookup(Charset.java:492) ~[na:na]
at java.base/java.nio.charset.Charset.forName(Charset.java:556) ~[na:na]
at org.apache.dubbo.remoting.http12.message.DefaultHttpRequest.getDecoder(DefaultHttpRequest.java:611) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.remoting.http12.message.DefaultHttpRequest.queryParameterValues(DefaultHttpRequest.java:441) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.remoting.http12.message.DefaultHttpRequest.queryParameter(DefaultHttpRequest.java:436) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.rest.mapping.ContentNegotiator.negotiate(ContentNegotiator.java:78) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.rest.mapping.RestRequestHandlerMapping.getRequestHandler(RestRequestHandlerMapping.java:90) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.route.DefaultRequestRouter.route(DefaultRequestRouter.java:50) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.doRoute(AbstractServerTransportListener.java:122) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onBeforeMetadata(AbstractServerTransportListener.java:118) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onMetadata(AbstractServerTransportListener.java:85) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.onMetadata(AbstractServerTransportListener.java:54) ~[dubbo-3.3.3.jar:3.3.3]
at org.apache.dubbo.remoting.http12.netty4.h1.NettyHttp1ConnectionHandler.channelRead0(NettyHttp1ConnectionHandler.java:56) ~[dubbo-3.3.3.jar:3.3.3]
What you expected to happen
Correctly parse HTTP header
Anything else
contentType
should be split to list, not just substring
Lines 242 to 257 in 403e127
public String charset() { | |
String charset = this.charset; | |
if (charset == null) { | |
String contentType = contentType(); | |
if (contentType == null) { | |
charset = StringUtils.EMPTY_STRING; | |
} else { | |
int index = contentType.lastIndexOf(HttpUtils.CHARSET_PREFIX); | |
charset = index == -1 | |
? StringUtils.EMPTY_STRING | |
: contentType.substring(index + 8).trim(); | |
} | |
this.charset = charset; | |
} | |
return charset.isEmpty() ? null : charset; | |
} |
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
component/need-triageNeed maintainers to triageNeed maintainers to triagetype/need-triageNeed maintainers to triageNeed maintainers to triage
Type
Projects
Status
Todo