Completed

REST with encoded special character (ie. [ and ]) appear to give 400 error

Using version 9.1.0

I submit a REST GET request with the following where <lab's website> is our hostname:

https://<lab's website>/rest/util/generateGraphicImage?&productName=%5B%22GTG_00_CAT_010_CONUS%22%5D&airportIdentifier=PDX001100&radius=100&minRunwayLength=50&labelsOn=true&width=1000&height=800&renderSectionals=false&forecastHour=15&includeCodedMessages=true&versionRequested=20170327

 

I get a 400 error code and the following response:

Status:
code:400
protocol:HTTP/1.1
Headers:
vary:accept-encoding
Connection:close
Set-Cookie:TS016a7697=01cb0d81e0d79ca988cc0cdef12214c790e82ef9c176414e90428f6ea18fc090bf42f08924434dad78b64b1b0e37b244875f83498df74145ccbf670df61ac3f4974f55d9f3; Path=/
Date:Tue, 13 Apr 2021 19:10:59 GMT
Content-Language:en
Content-Type:text/html;charset=utf-8
Body:
<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Invalid character found in the request target [&#47;Website14&#47;rest&#47;util&#47;generateGraphicImage?&amp;productName=[%22GTG_00_CAT_010_CONUS%22]&amp;airportIdentifier=PDX001100&amp;radius=100&amp;minRunwayLength=50&amp;labelsOn=true&amp;width=1000&amp;height=800&amp;renderSectionals=false&amp;forecastHour=15&amp;includeCodedMessages=true&amp;versionRequested=20170327]. The valid characters are defined in RFC 7230 and RFC 3986</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Invalid character found in the request target [&#47;Website14&#47;rest&#47;util&#47;generateGraphicImage?&amp;productName=[%22GTG_00_CAT_010_CONUS%22]&amp;airportIdentifier=PDX001100&amp;radius=100&amp;minRunwayLength=50&amp;labelsOn=true&amp;width=1000&amp;height=800&amp;renderSectionals=false&amp;forecastHour=15&amp;includeCodedMessages=true&amp;versionRequested=20170327]. The valid characters are defined in RFC 7230 and RFC 3986
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:490)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:880)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1601)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.base&#47;java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base&#47;java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.base&#47;java.lang.Thread.run(Thread.java:834)
</pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /><h3>Apache Tomcat</h3></body></html>

0
8 comments
Avatar
Joseph Hamdan

Hi Dominic,

Does this request execute correctly using Postman, for example? Just to verify that the request is valid.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Dominic Luminello

Yes, this does work in the tool we use and returns the expected result.

 

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Dominc,

Could you please advise if Content-type: application/x-www-form-urlencoded is applied to the Rest Connection that you are using?

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Dominic Luminello

Yes, it is.

0
Comment actions Permalink
Avatar
Rex Feizi

Dominic, 

The question is more of what is the headers used in Postman, so we can make sure the same headers are used in the connection definition. 

0
Comment actions Permalink
Avatar
Dominic Luminello

We use a plugin to FireFox called 'RESTClient' for manual testing.

Here is the only request header we set and then the response headers coming back.

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Dominic,

We have added a fix for this issue in 9.1.2 release which is now available in production.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Dominic Luminello

Thank you.  Will update when we can and try it out.

0
Comment actions Permalink

Please sign in to leave a comment.