Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppService doesn't support POST of JSON containing % and then & #173

Closed
A1kmm opened this issue Oct 23, 2014 · 2 comments

Comments

@A1kmm
Copy link

commented Oct 23, 2014

We are using Finatra for a microservice that processes JSON requests. However, using AppService, Finatra fails on a POST request with a body like the following:

{"test":"%","blah":"&"}

With the following stack trace:

ERR [20141023-07:18:44.842] finatra: org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder$ErrorDataDecoderException:     Bad string: '{"test":"%","blah":"'

ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.decodeAttribute(HttpPostStandardRequestDecoder.java:532)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBodyAttributes(HttpPostStandardRequestDecoder.java:412)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBody(HttpPostStandardRequestDecoder.java:232)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.(HttpPostStandardRequestDecoder.java:150)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.(HttpPostRequestDecoder.java:88)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.(HttpPostRequestDecoder.java:46)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.MultipartParsing$.apply(MultipartParsing.scala:28)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.RequestAdapter$.apply(RequestAdapter.scala:32)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.AppService.apply(AppService.scala:28)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.AppService.apply(AppService.scala:22)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.FileService.apply(FileService.scala:120)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.FileService.apply(FileService.scala:85)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Filter$$anon$2.apply(Filter.scala:69)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.LoggingFilter.apply(LoggingFilter.scala:11)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.LoggingFilter.apply(LoggingFilter.scala:8)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Filter$$anon$2.apply(Filter.scala:69)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
... Filter in the application ...
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Filter$$anon$2.apply(Filter.scala:69)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
... Filter in the application ...
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Filter$$anon$2.apply(Filter.scala:69)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:11)
... Application ...
ERR [20141023-07:18:44.842] finatra: (...more...)
ERR [20141023-07:18:44.842] finatra: Caused by java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "","
ERR [20141023-07:18:44.842] finatra: at java.net.URLDecoder.decode(URLDecoder.java:192)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.decodeAttribute(HttpPostStandardRequestDecoder.java:528)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBodyAttributes(HttpPostStandardRequestDecoder.java:412)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBody(HttpPostStandardRequestDecoder.java:232)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.(HttpPostStandardRequestDecoder.java:150)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.(HttpPostRequestDecoder.java:88)
ERR [20141023-07:18:44.842] finatra: at org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder.(HttpPostRequestDecoder.java:46)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.MultipartParsing$.apply(MultipartParsing.scala:28)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.RequestAdapter$.apply(RequestAdapter.scala:32)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.AppService.apply(AppService.scala:28)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.AppService.apply(AppService.scala:22)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.FileService.apply(FileService.scala:120)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.FileService.apply(FileService.scala:85)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Filter$$anon$2.apply(Filter.scala:69)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.LoggingFilter.apply(LoggingFilter.scala:11)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finatra.LoggingFilter.apply(LoggingFilter.scala:8)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Filter$$anon$2.apply(Filter.scala:69)
ERR [20141023-07:18:44.842] finatra: at com.twitter.finagle.Service$$anon$1.apply(Service.scala:14)
...

It looks like RequestAdapter unconditionally tries to use MultipartParsing on all requests, and if it fails with an exception, the whole request fails even if this parsing is not required for the content type.

@scosenza

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2015

Fixed in v2.x

@scosenza scosenza closed this Aug 15, 2015

@haochun

This comment has been minimized.

Copy link

commented Aug 3, 2016

i also occured the same problem,does it fix?how did you fix,i am use vert.x,it is also use netty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.