* This class only represents the HTTP header, it does not represent an entity body. If the request needs an entity
* body then this must be specified by either setting a Content-Length or Transfer-Encoding header, otherwise
* the client will assume that the body is empty.
The issue is that it is reporting the wrong protocol in the response,
I have fixed this upstream.
Stuart
On Thu, Mar 23, 2017 at 1:31 AM, Steve Hu <stevehu@gmail.com> wrote:
> Hi Stuart,
>
> Thanks for the upgrade handler fix. I can clearly see the handler is
> registered and handleRequest is called in a debug session. I also replaced
> EMPTY option with OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) when
> opening client connection. The response protocol is still HTTP/1.1 for both
> http and https requests. The following is the output from the console and
> the syched/updated source code can be found
> https://github.com/stevehu/undertow/blob/master/core/src/ test/java/io/undertow/client/ http/Http2ClientTestCase.java
>
> 10:16:43,804 INFO (main) [org.xnio] <Xnio.java:99> XNIO version 3.3.6.Final
> 10:16:43,829 INFO (main) [org.xnio.nio] <NioXnio.java:55> XNIO NIO
> Implementation Version 3.3.6.Final
> 10:17:42,980 DEBUG (main) [io.undertow.request.io] <Http2Channel.java:753>
> Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7778 local
> /127.0.0.1:64696[ No Receiver [] -- [] -- []]:
> java.nio.channels.ClosedChannelException
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:753)
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:744)
> at
> io.undertow.client.http2.Http2ClientConnection.close( Http2ClientConnection.java: 312)
> at org.xnio.IoUtils.safeClose(IoUtils.java:134)
> at
> io.undertow.client.http.Http2ClientTestCase. testHttpsConnectionClose( Http2ClientTestCase.java:245)
> at sun.reflect.NativeMethodAccessorImpl. invoke0(Native Method)
> HTTP/1.1
> at
> sun.reflect.NativeMethodAccessorImpl. invoke( NativeMethodAccessorImpl.java: 62)
> at
> sun.reflect.DelegatingMethodAccessorImpl. invoke( DelegatingMethodAccessorImpl. java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.junit.runners.model.FrameworkMethod$1. runReflectiveCall( FrameworkMethod.java:50)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run( ReflectiveCallable.java:12)
> at
> org.junit.runners.model.FrameworkMethod. invokeExplosively( FrameworkMethod.java:47)
> at
> org.junit.internal.runners.statements.InvokeMethod. evaluate(InvokeMethod.java:17)
> at org.junit.runners.ParentRunner.runLeaf( ParentRunner.java:325)
> at
> org.junit.runners.BlockJUnit4ClassRunner. runChild( BlockJUnit4ClassRunner.java: 78)
> at
> org.junit.runners.BlockJUnit4ClassRunner. runChild( BlockJUnit4ClassRunner.java: 57)
> at org.junit.runners.ParentRunner$3.run( ParentRunner.java:290)
> at org.junit.runners.ParentRunner$1.schedule( ParentRunner.java:71)
> at org.junit.runners.ParentRunner.runChildren( ParentRunner.java:288)
> at org.junit.runners.ParentRunner.access$000( ParentRunner.java:58)
> at org.junit.runners.ParentRunner$2.evaluate( ParentRunner.java:268)
> at
> org.junit.internal.runners.statements.RunBefores. evaluate(RunBefores.java:26)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate( RunAfters.java:27)
> at org.junit.runners.ParentRunner.run(ParentRunner. java:363)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at
> com.intellij.junit4.JUnit4IdeaTestRunner. startRunnerWithArgs( JUnit4IdeaTestRunner.java:117)
> at
> com.intellij.junit4.JUnit4IdeaTestRunner. startRunnerWithArgs( JUnit4IdeaTestRunner.java:42)
> at
> com.intellij.rt.execution.junit.JUnitStarter. prepareStreamsAndStart( JUnitStarter.java:262)
> at com.intellij.rt.execution.junit.JUnitStarter.main( JUnitStarter.java:84)
>
> 10:17:42,986 DEBUG (Client I/O-7) [io.undertow.request.io]
> <AbstractFramedChannel.java:791> Channel Http2Channel peer
> localhost/127.0.0.1:7778 local /127.0.0.1:64696[ No Receiver [] -- [] -- []]
> is being closed: java.nio.channels.ClosedChannelException
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel. close(AbstractFramedChannel. java:791)
> at org.xnio.IoUtils.safeClose(IoUtils.java:134)
> at
> io.undertow.protocols.http2.Http2Channel$3.handleEvent( Http2Channel.java:762)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners. java:421)
> at org.xnio.ChannelListeners$14.handleEvent(ChannelListeners. java:409)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> io.undertow.server.protocol.framed. AbstractFramedStreamSinkChanne l$1.run( AbstractFramedStreamSinkChanne l.java:212)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ 3.run(AbstractFramedChannel. java:231)
> at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580)
> at org.xnio.nio.WorkerThread.run(WorkerThread.java:464)
>
> 10:17:42,986 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io]
> <Http2Channel.java:753> Sending goaway on channel Http2Channel peer
> /127.0.0.1:64696 local /127.0.0.1:7778[ No Receiver [] -- [] -- []]:
> java.nio.channels.ClosedChannelException
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:753)
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:744)
> at
> io.undertow.protocols.http2.Http2Channel. createChannelImpl( Http2Channel.java:478)
> at
> io.undertow.protocols.http2.Http2Channel.createChannel( Http2Channel.java:317)
> at
> io.undertow.protocols.http2.Http2Channel.createChannel( Http2Channel.java:65)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel. receive(AbstractFramedChannel. java:452)
> at
> io.undertow.server.protocol.http2.Http2ReceiveListener. handleEvent( Http2ReceiveListener.java:106)
> at
> io.undertow.server.protocol.http2.Http2ReceiveListener. handleEvent( Http2ReceiveListener.java:57)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ FrameReadListener.handleEvent( AbstractFramedChannel.java: 931)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ FrameReadListener.handleEvent( AbstractFramedChannel.java: 912)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> org.xnio.conduits.ReadReadyHandler$ ChannelListenerHandler. readReady(ReadReadyHandler. java:66)
> at
> io.undertow.protocols.ssl.SslConduit$ SslReadReadyHandler.readReady( SslConduit.java:1129)
> at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit. java:88)
> at org.xnio.nio.WorkerThread.run(WorkerThread.java:559)
>
> 10:17:42,988 DEBUG (XNIO-1 I/O-7) [io.undertow.request.io]
> <AbstractFramedChannel.java:791> Channel Http2Channel peer /127.0.0.1:64696
> local /127.0.0.1:7778[ No Receiver [] -- [] -- []] is being closed:
> java.nio.channels.ClosedChannelException
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel. close(AbstractFramedChannel. java:791)
> at org.xnio.IoUtils.safeClose(IoUtils.java:134)
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:767)
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:744)
> at
> io.undertow.protocols.http2.Http2Channel. createChannelImpl( Http2Channel.java:478)
> at
> io.undertow.protocols.http2.Http2Channel.createChannel( Http2Channel.java:317)
> at
> io.undertow.protocols.http2.Http2Channel.createChannel( Http2Channel.java:65)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel. receive(AbstractFramedChannel. java:452)
> at
> io.undertow.server.protocol.http2.Http2ReceiveListener. handleEvent( Http2ReceiveListener.java:106)
> at
> io.undertow.server.protocol.http2.Http2ReceiveListener. handleEvent( Http2ReceiveListener.java:57)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ FrameReadListener.handleEvent( AbstractFramedChannel.java: 931)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ FrameReadListener.handleEvent( AbstractFramedChannel.java: 912)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> org.xnio.conduits.ReadReadyHandler$ ChannelListenerHandler. readReady(ReadReadyHandler. java:66)
> at
> io.undertow.protocols.ssl.SslConduit$ SslReadReadyHandler.readReady( SslConduit.java:1129)
> at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit. java:88)
> at org.xnio.nio.WorkerThread.run(WorkerThread.java:559)
>
> 10:17:43,001 DEBUG (Client I/O-7) [io.undertow.request.io]
> <Http2ClientConnection.java:458> UT005013: An IOException occurred:
> java.nio.channels.ClosedChannelException
> at
> io.undertow.client.http2.Http2ClientConnection$ Http2ReceiveListener. handleEvent( Http2ClientConnection.java: 452)
> at
> io.undertow.client.http2.Http2ClientConnection$ Http2ReceiveListener. handleEvent( Http2ClientConnection.java: 366)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ FrameReadListener.handleEvent( AbstractFramedChannel.java: 931)
> at
> io.undertow.server.protocol.framed.AbstractFramedChannel$ FrameReadListener.handleEvent( AbstractFramedChannel.java: 912)
> at org.xnio.ChannelListeners.invokeChannelListener( ChannelListeners.java:92)
> at
> org.xnio.conduits.ReadReadyHandler$ ChannelListenerHandler. readReady(ReadReadyHandler. java:66)
> at
> io.undertow.protocols.ssl.SslConduit$ SslReadReadyHandler.readReady( SslConduit.java:1129)
> at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit. java:168)
> at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580)
> at org.xnio.nio.WorkerThread.run(WorkerThread.java:464)
>
> HTTP/1.1
> 10:20:14,473 DEBUG (main) [io.undertow.request.io] <Http2Channel.java:753>
> Sending goaway on channel Http2Channel peer localhost/127.0.0.1:7777 local
> /127.0.0.1:64697[ No Receiver [] -- [] -- []]:
> java.nio.channels.ClosedChannelException
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:753)
> at
> io.undertow.protocols.http2.Http2Channel.sendGoAway( Http2Channel.java:744)
>
> at
> io.undertow.client.http2.Http2ClientConnection.close( Http2ClientConnection.java: 312)
> at org.xnio.IoUtils.safeClose(IoUtils.java:134)
> at
> io.undertow.client.http.Http2ClientTestCase. testHttpConnectionClose( Http2ClientTestCase.java:220)
> at sun.reflect.NativeMethodAccessorImpl. invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl. invoke( NativeMethodAccessorImpl.java: 62)
> at
> sun.reflect.DelegatingMethodAccessorImpl. invoke( DelegatingMethodAccessorImpl. java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.junit.runners.model.FrameworkMethod$1. runReflectiveCall( FrameworkMethod.java:50)