tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Tomcat 9 throws exception when sending unencoded charecters in QueryString
Date Wed, 19 Dec 2018 08:26:53 GMT
On 19/12/2018 04:58, Melvin wrote:
> Hi Christopher Schultz,
> *
> *
> I did not mean that the browser is throwing an error. My problem is that
> in 9.0.13 tomcat's error page is shown instead of my error page.

As Rémy has already explained:

- The URL is invalid
- Therefore, Tomcat reports an error
- Since the URL is invalid, Tomcat doesn't try mapping it to an
  application
- Therefore Tomcat doesn't use your application's error page
- Therefore you get Tomcat's standard error page via the
  ErrorReportValve

If you want to provide custom responses with the ErrorReportValve then
as of 9.0.6 onwards you can do so with static files (rather than
overriding the ErrorReportValve).

See

http://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Error_Report_Valve


and look for errorCode.nnn and exceptionType.fullyQualifiedClassName

Mark


> I have
> given error page location in web.xml. error.jsp is located in the root
> of my webapp.
> 
> I know that if I add '^' in relaxedquerychars there will be no error
> thrown by the server. I have no characters in my relaxedquerychars. In
> 8.5.35 the requested is rejected and tomcat's error page with
> exception is not shown, but it does in 9.0.13.
> 
> I will attach both the screenshots of 9.0.13 and 8.5.35. You kindly
> check and let me know. 
> 
> Regards,
> Melvin A
> 
> 
> On Tue, Dec 18, 2018 at 8:48 PM Christopher Schultz
> <chris@christopherschultz.net <mailto:chris@christopherschultz.net>> wrote:
> 
> Melvin,
> 
> On 12/18/18 04:21, Melvin wrote:
>> Tomcat 9.0.13 I switched from tomcat 8.5.35 to 9.0.13. In 8.5 when
>> I send an unencoded character in queryString it throws 400 error in
>> the browser itself and no Exception is thrown or seen explicitly.
> 
> That doesn't make any sense. Browsers don't throw HTTP errors.
> 
>> After I switched to tomcat 9, when I send an unencoded character
>> in queryString it throws Exception and tomcat error page is shown.
> As it should be.
> 
>> I configured error-page in both the servers.
> 
> How/where?
> 
>> I know that these characters can be relaxed by adding them in
>> relaxedquerychars in server.xml. But still it is a 400 error and
>> ideally it must redirect me to the configured error page.
> Are you saying that configuring relaxedquerychars does not work? If
> so, please post that configuration.
> 
>> Also when the response.setStatus(400) is called, error page is not
>> redirected in both the servers.
> 
> Where are you configuring your error page. This isn't unambiguous:
> 
>> web.xml <web-app> <error-page> <error-code>400</error-code>
>> <location>/error.jsp</location> </error-page> <error-page>
>> <error-code>500</error-code> <location>/error.jsp</location>
>> </error-page> </web-app>
> 
> 
>> URL=http://localhost:9013/app1/paramTest.jsp?name=^ Tomcat 8.5.32
>> - 'This page isn’t working' is shown in browser. Tomcat 9.0.13 -
>> java.lang.IllegalArgumentException: Invalid character found in the
>> request target. The valid characters are defined in RFC 7230 and
>> RFC 3986
>> org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11Inpu
> tBuffer.java:467)
> 
> 
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:29
> 4)
>> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLigh
> t.java:66)
> 
> 
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractPro
> tocol.java:791)
>> org.apache.tomcat.util.net
> <http://org.apache.tomcat.util.net>.NioEndpoint$SocketProcessor.doRun(NioEndpoi
> nt.java:1417)
> 
> 
> org.apache.tomcat.util.net
> <http://org.apache.tomcat.util.net>.SocketProcessorBase.run(SocketProcessorBase.j
> ava:49)
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j
> ava:1149)
> 
> 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
> va:624)
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThr
> ead.java:61)
> 
> 
> java.lang.Thread.run(Thread.java:748) is thrown and tomcat error page is
>> shown. I have attached the screenshot of the exception thrown.
> 
> Attachments are stripped, but presumably, it's just a screenshot of
> the above.
> 
> Please explain where you have configured that error page, and show
> your relaxedquerychars setting (if you have one).
> 
> -chris
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>     <mailto:users-unsubscribe@tomcat.apache.org>
>     For additional commands, e-mail: users-help@tomcat.apache.org
>     <mailto:users-help@tomcat.apache.org>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message