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

StaticContentHandler fails with encoded URLs #1711

Closed
barchetta opened this issue May 1, 2020 · 3 comments
Closed

StaticContentHandler fails with encoded URLs #1711

barchetta opened this issue May 1, 2020 · 3 comments
Assignees
Labels
1.x Issues for 1.x version branch 2.x Issues for 2.x version branch bug Something isn't working P1
Projects

Comments

@barchetta
Copy link
Member

barchetta commented May 1, 2020

Environment Details

  • Helidon Version: 2.0.0-SNAPSHOT

Problem Description

When an encoded URL is processed by ClassPathContentHandler it fails with an IllegalArgumentException and generates a 500 server error. This is a regression and breaks examples/microprofile/messaging-sse

Also, the exception is logged at the FINE level. Anything that generates a 500 should log the error at the ERROR level.

Here is the exception:

[Fri May 01 10:34:47 PDT 2020] FINEST: io.helidon.webserver.RequestRouting$RoutedRequest next - (reqID: 3) Routing next: /example/send/Fly Helidon!
[Fri May 01 10:34:47 PDT 2020] FINEST: io.helidon.webserver.ClassPathContentHandler doHandle - Requested class path resource: WEB/example/send/Fly Helidon!
[Fri May 01 10:34:47 PDT 2020] FINE: io.helidon.webserver.StaticContentHandler handle - Failed to access static resource
java.lang.IllegalArgumentException: Illegal character in path at index 20: WEB/example/send/Fly Helidon!
	at java.base/java.net.URI.create(URI.java:883)
	at io.helidon.webserver.ClassPathContentHandler.doHandle(ClassPathContentHandler.java:95)
	at io.helidon.webserver.StaticContentHandler.handle(StaticContentHandler.java:79)
	at io.helidon.webserver.StaticContentSupport.lambda$update$0(StaticContentSupport.java:64)
	at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:317)
	at io.helidon.media.jsonp.server.JsonSupport.accept(JsonSupport.java:98)
	at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:317)
	at io.helidon.media.jsonp.server.JsonSupport.accept(JsonSupport.java:98)
	at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:317)
	at io.helidon.metrics.MetricsSupport$MetricsContextHandler.accept(MetricsSupport.java:621)
	at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:317)
	at io.helidon.metrics.MetricsSupport.lambda$configureVendorMetrics$7(MetricsSupport.java:372)
	at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:317)
	at io.helidon.webserver.WebTracingConfig$RequestSpanHandler.accept(WebTracingConfig.java:234)
	at io.helidon.webserver.RequestRouting$RoutedRequest.next(RequestRouting.java:317)
	at io.helidon.common.context.Contexts.runInContext(Contexts.java:98)
	at io.helidon.webserver.RequestRouting.route(RequestRouting.java:82)
	at io.helidon.webserver.ForwardingHandler.channelRead0(ForwardingHandler.java:153)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.URISyntaxException: Illegal character in path at index 20: WEB/example/send/Fly Helidon!
	at java.base/java.net.URI$Parser.fail(URI.java:2915)
	at java.base/java.net.URI$Parser.checkChars(URI.java:3086)
	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3168)
	at java.base/java.net.URI$Parser.parse(URI.java:3127)
	at java.base/java.net.URI.<init>(URI.java:600)
	at java.base/java.net.URI.create(URI.java:881)
	... 39 more

[Fri May 01 10:34:47 PDT 2020] FINEST: io.helidon.webserver.RequestRouting$RoutedRequest nextNoCheck - (reqID: 3) Routing error: class io.helidon.webserver.HttpException
[Fri May 01 10:34:47 PDT 2020] FINEST: io.helidon.webserver.BareResponseImpl writeStatusAndHeaders - (reqID: 3) Writing headers: 500 Internal Server Error

Steps to reproduce

  1. Go to examples/microprofile/messaging-sse and change logging.properties so that .level=FINEST
  2. Build and run examples/microprofile/messaging-sse
  3. Load page in browser and click Send (which by defaults sends text with spaces that must be URL encoded).
  4. See error from server
@barchetta barchetta added bug Something isn't working 2.x Issues for 2.x version branch labels May 1, 2020
@barchetta barchetta added this to Needs triage in Backlog via automation May 1, 2020
@m0mus m0mus added the P1 label May 7, 2020
@m0mus m0mus moved this from Needs triage to High priority in Backlog May 7, 2020
@barchetta barchetta added the 1.x Issues for 1.x version branch label May 8, 2020
@barchetta
Copy link
Member Author

barchetta commented May 8, 2020

I've had confirmation this bug exists in 1.4.4 as well.

barchetta added a commit to barchetta/helidon that referenced this issue May 15, 2020
@barchetta
Copy link
Member Author

For 2.0 see PR #1811

Backlog automation moved this from High priority to Closed May 18, 2020
@barchetta
Copy link
Member Author

barchetta commented May 18, 2020

For 1.4.5 see PR #1817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Issues for 1.x version branch 2.x Issues for 2.x version branch bug Something isn't working P1
Projects
Backlog
  
Closed
Development

No branches or pull requests

2 participants