[
https://issues.apache.org/jira/browse/SCB-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16323346#comment-16323346
]
ASF GitHub Bot commented on SCB-221:
------------------------------------
liubao68 closed pull request #505: [SCB-221] merge vertx 3.5.0 BodyHandlerImpl
changes
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/505
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/transports/transport-rest/transport-rest-vertx/src/main/java/io/servicecomb/transport/rest/vertx/RestBodyHandler.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/io/servicecomb/transport/rest/vertx/RestBodyHandler.java
index 2eb62714d..a92901259 100644
---
a/transports/transport-rest/transport-rest-vertx/src/main/java/io/servicecomb/transport/rest/vertx/RestBodyHandler.java
+++
b/transports/transport-rest/transport-rest-vertx/src/main/java/io/servicecomb/transport/rest/vertx/RestBodyHandler.java
@@ -23,6 +23,7 @@
import javax.ws.rs.core.Response.Status;
+import io.netty.handler.codec.http.HttpHeaderValues;
import
io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.ErrorDataDecoderException;
import io.servicecomb.swagger.invocation.exception.CommonExceptionData;
import io.servicecomb.swagger.invocation.exception.ExceptionFactory;
@@ -134,8 +135,14 @@ public BodyHandler setDeleteUploadedFilesOnEnd(boolean
deleteUploadedFilesOnEnd)
Set<FileUpload> fileUploads = context.fileUploads();
final String contentType =
context.request().getHeader(HttpHeaders.CONTENT_TYPE);
- isMultipart = contentType != null &&
contentType.contains("multipart/form-data");
- isUrlEncoded = contentType != null &&
contentType.contains("application/x-www-form-urlencoded");
+ if (contentType == null) {
+ isMultipart = false;
+ isUrlEncoded = false;
+ } else {
+ final String lowerCaseContentType = contentType.toLowerCase();
+ isMultipart =
lowerCaseContentType.startsWith(HttpHeaderValues.MULTIPART_FORM_DATA.toString());
+ isUrlEncoded =
lowerCaseContentType.startsWith(HttpHeaderValues.APPLICATION_X_WWW_FORM_URLENCODED.toString());
+ }
if (isMultipart || isUrlEncoded) {
makeUploadDir(context.vertx().fileSystem());
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> merge vertx 3.5.0 BodyHandlerImpl changes
> -----------------------------------------
>
> Key: SCB-221
> URL: https://issues.apache.org/jira/browse/SCB-221
> Project: Apache ServiceComb
> Issue Type: Task
> Components: Java-Chassis
> Reporter: wujimin
> Assignee: wujimin
> Fix For: java-chassis-1.0.0-m1
>
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)