[undertow-dev] Enable HTTP/2 and get JDK9 ALPN not supported

Stuart Douglas sdouglas at redhat.com
Wed Mar 22 21:40:14 EDT 2017


I have added one:
https://github.com/undertow-io/undertow/commit/20be7eb052a1efd44c8a1e6981f269344174543a#diff-f92c46f6546a565ef565e205b726ccf8R174

On Thu, Mar 23, 2017 at 11:07 AM, Steve Hu <stevehu at gmail.com> wrote:
> Hi Stuart,
>
> I am trying to find an example or test case that uses http post for
> HttpClient but couldn't find anything. The only information is the comment
> of ClientRequest. Could you please provide an example on how to push body in
> a post ClientRequest?
>
> Thanks,
>
> Steve
>
> * 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.
>
>
>
> On Wed, Mar 22, 2017 at 5:01 PM, Stuart Douglas <sdouglas at redhat.com> wrote:
>>
>> 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 at 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.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.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)
>> > 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:20:14,474 DEBUG (Client I/O-4) [io.undertow.request.io]
>> > <AbstractFramedChannel.java:791> Channel Http2Channel peer
>> > localhost/127.0.0.1:7777 local /127.0.0.1:64697[ 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 org.xnio.ChannelListeners$4.run(ChannelListeners.java:147)
>> > at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580)
>> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:464)
>> >
>> > 10:20:14,474 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io]
>> > <Http2Channel.java:753> Sending goaway on channel Http2Channel peer
>> > /127.0.0.1:64697 local /127.0.0.1:7777[ 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 org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
>> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559)
>> >
>> > 10:20:14,476 DEBUG (XNIO-1 I/O-1) [io.undertow.request.io]
>> > <AbstractFramedChannel.java:791> Channel Http2Channel peer
>> > /127.0.0.1:64697
>> > local /127.0.0.1:7777[ 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 org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
>> > at org.xnio.nio.WorkerThread.run(WorkerThread.java:559)
>> >
>> >
>> > On Tue, Mar 21, 2017 at 11:39 PM, Stuart Douglas <sdouglas at redhat.com>
>> > wrote:
>> >>
>> >> On Wed, Mar 22, 2017 at 12:50 PM, Steve Hu <stevehu at gmail.com> wrote:
>> >> > Hi Stuart,
>> >> >
>> >> > I debugged into the ALPN code and found some issues with Http2Client.
>> >> >
>> >> > I started with the Http2Server example and found
>> >> > LoadBalancingProxyClient is
>> >> > using an instance of UndertowClient which can only load HTTP1.1
>> >> > ClientProviders. The following is the code to get ClientProvider and
>> >> > only
>> >> > "http" or "https" can be the return from uri.getSchema().
>> >> >
>> >> > ClientProvider provider = clientProviders.get(uri.getScheme());
>> >> >
>> >> > If this is true, then the communication between the proxy and Http/2
>> >> > server
>> >> > is Http/1.1
>> >>
>> >> You need to pass in the ENABLE_HTTP2 option in the OptionsMap. For
>> >> http URI's this means that the client will attempt an upgrade on the
>> >> first request, for https URI's ALPN will be used to try and negotiate
>> >> HTTP/2. This is how browsers behave, and will work even if the target
>> >> does not support HTTP/2.
>> >>
>> >> One thing I did notice that I fixed upstream was that the Undertow
>> >> builder was not registering a HTTP2UpgradeHandler when HTTP/2 was
>> >> enabled, which has been fixed.
>> >>
>> >> >
>> >> > In addition, I have created a new class UndertowHttp2Client and
>> >> > Http2ClientTestCase in my forked repo to try
>> >> >
>> >> > the Http2ClientProviders and found all three http2 client providers
>> >> > don't
>> >> > work as expected.
>> >> >
>> >> > h2c and h2-prior got 200 response code back during handshake and h2
>> >> > works
>> >> > but the connection is still http 1.1
>> >>
>> >> I think this was probably caused by the lack of the upgrade handler
>> >> (well for h2c, h2c-prior should still work).
>> >>
>> >> Stuart
>> >>
>> >> >
>> >> > I am debugging the ALPN code now but it is very slow as I have to dig
>> >> > into
>> >> > the spec to learn how the handshake works.
>> >> >
>> >> > As you have resolved the ALPN boot jar issue with the hack, I think
>> >> > Undertow
>> >> > is very usable for HTTP/2 and it would
>> >> >
>> >> > be perfect if the client is working as well. Could you please confirm
>> >> > my
>> >> > findings and let me know direction I should
>> >> >
>> >> > focus on?
>> >>
>> >>
>> >> >
>> >> >
>> >> > Thanks,
>> >> >
>> >> >
>> >> > Steve
>> >> >
>> >> >
>> >> > Here is my repo with UndertowHttp2Client and Test.
>> >> >
>> >> > https://github.com/stevehu/undertow
>> >> >
>> >> >
>> >> > And here is the files I have added.
>> >> >
>> >> >
>> >> >
>> >> > https://github.com/stevehu/undertow/blob/master/core/src/main/java/io/undertow/client/UndertowHttp2Client.java
>> >> >
>> >> >
>> >> >
>> >> > https://github.com/stevehu/undertow/blob/master/core/src/test/java/io/undertow/client/http/Http2ClientTestCase.java
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > On Sun, Mar 19, 2017 at 8:23 PM, Stuart Douglas <sdouglas at redhat.com>
>> >> > wrote:
>> >> >>
>> >> >> I don't really have time to do it (there is no real benefit for
>> >> >> Undertow, so it is not high on my priority list), but the code is
>> >> >> all
>> >> >> Apache licensed so there is no reason why you can't start a project
>> >> >> that provides this code as a standalone implementation.
>> >> >>
>> >> >> You would still need to implement code in Netty etc to actually use
>> >> >> this as well, as there is no standardized ALPN API yet.
>> >> >>
>> >> >> Stuart
>> >> >>
>> >> >> On Mon, Mar 20, 2017 at 11:07 AM, Steve Hu <stevehu at gmail.com>
>> >> >> wrote:
>> >> >> > I am reading the code in client package and they look really good.
>> >> >> > As
>> >> >> > currently none of the http/2 client library has a work around on
>> >> >> > alpn
>> >> >> > boot
>> >> >> > jar and this blocks majority of developers to move to http/2. I am
>> >> >> > wondering
>> >> >> > if you want to split client package to a standalone client module
>> >> >> > so
>> >> >> > that it
>> >> >> > can be used by other developers to connect to servers that
>> >> >> > implement
>> >> >> > http/2.
>> >> >> > If you are interested in it, I can help to create a pull request
>> >> >> > and
>> >> >> > add
>> >> >> > some test cases while I am working on my own client
>> >> >> > implementation.
>> >> >> > Thanks.
>> >> >> >
>> >> >> > On Sun, Mar 19, 2017 at 5:32 PM, Stuart Douglas
>> >> >> > <sdouglas at redhat.com>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> You could use Undertow's HTTP/2 client, although it's API was
>> >> >> >> designed
>> >> >> >> around the reverse proxy use case and as a result is not ideal
>> >> >> >> for
>> >> >> >> the
>> >> >> >> general purpose HTTP client use case (although it is still
>> >> >> >> perfectly
>> >> >> >> usable).
>> >> >> >>
>> >> >> >> In terms of using Undertow's ALPN implementation with Netty etc
>> >> >> >> it
>> >> >> >> would require someone to port it over. The code is at [1] if you
>> >> >> >> are
>> >> >> >> interested.
>> >> >> >>
>> >> >> >> Stuart
>> >> >> >>
>> >> >> >> [1]
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/protocols/ssl/ALPNHackSSLEngine.java
>> >> >> >>
>> >> >> >> On Mon, Mar 20, 2017 at 7:21 AM, Steve Hu <stevehu at gmail.com>
>> >> >> >> wrote:
>> >> >> >> > Thanks Stuart for the quick response. Now I have server started
>> >> >> >> > with
>> >> >> >> > HTTP/2
>> >> >> >> > and it works perfect with some client tools. Now I am looking
>> >> >> >> > for
>> >> >> >> > Java
>> >> >> >> > HTTP/2 client libraries to update my client module to support
>> >> >> >> > HTTP/2
>> >> >> >> > protocol for microservices communication. There are three major
>> >> >> >> > libraries
>> >> >> >> > okhttp, jetty and netty but all of them require Jetty's ALPN
>> >> >> >> > boot
>> >> >> >> > JAR. I
>> >> >> >> > saw
>> >> >> >> > you have resolved the boot jar dependency in Undertow and am
>> >> >> >> > wondering
>> >> >> >> > if
>> >> >> >> > you could point me to the right direction. Do you have any
>> >> >> >> > recommendation
>> >> >> >> > for HTTP/2 client library? How do you work around the alpn boot
>> >> >> >> > jar?
>> >> >> >> > Is
>> >> >> >> > the
>> >> >> >> > same solution can be used by okhttp, jetty and netty before
>> >> >> >> > Java 9
>> >> >> >> > is
>> >> >> >> > released?
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Fri, Mar 17, 2017 at 11:03 PM, Stuart Douglas
>> >> >> >> > <sdouglas at redhat.com>
>> >> >> >> > wrote:
>> >> >> >> >>
>> >> >> >> >> No, that is a debug level message. The JDK8 ALPN provider
>> >> >> >> >> should
>> >> >> >> >> still
>> >> >> >> >> be registered.
>> >> >> >> >>
>> >> >> >> >> Stuart
>> >> >> >> >>
>> >> >> >> >> On Sat, Mar 18, 2017 at 12:18 PM, Steve Hu <stevehu at gmail.com>
>> >> >> >> >> wrote:
>> >> >> >> >> > Hi,
>> >> >> >> >> >
>> >> >> >> >> > I searched this mailing list and one post mentioned that I
>> >> >> >> >> > don't
>> >> >> >> >> > need
>> >> >> >> >> > to
>> >> >> >> >> > use
>> >> >> >> >> > -Xbootclasspath/p:<path_to_alpn_boot_jar> after 1.4.0Final.
>> >> >> >> >> > I
>> >> >> >> >> > am
>> >> >> >> >> > trying
>> >> >> >> >> > HTTP/2 on my server with 1.4.10 and Oracle JDK 1.8 but when
>> >> >> >> >> > I
>> >> >> >> >> > start
>> >> >> >> >> > the
>> >> >> >> >> > server I got the following error. Do I have to use OpenJDK
>> >> >> >> >> > 8?
>> >> >> >> >> > If I
>> >> >> >> >> > switch to
>> >> >> >> >> > JBoss OpenSSL implementation?
>> >> >> >> >> >
>> >> >> >> >> > Thanks,
>> >> >> >> >> >
>> >> >> >> >> > Steve
>> >> >> >> >> >
>> >> >> >> >> > 21:00:36.468 [main]  DEBUG io.undertow - Configuring
>> >> >> >> >> > listener
>> >> >> >> >> > with
>> >> >> >> >> > protocol
>> >> >> >> >> > HTTPS for interface 0.0.0.0 and port 8843
>> >> >> >> >> >
>> >> >> >> >> > 21:00:36.486 [main]  DEBUG io.undertow - JDK9 ALPN not
>> >> >> >> >> > supported
>> >> >> >> >> >
>> >> >> >> >> > java.lang.NoSuchMethodException:
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;)
>> >> >> >> >> >
>> >> >> >> >> > at java.lang.Class.getMethod(Class.java:1786)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43)
>> >> >> >> >> >
>> >> >> >> >> > at java.security.AccessController.doPrivileged(Native
>> >> >> >> >> > Method)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.protocols.alpn.JDK9AlpnProvider.<clinit>(JDK9AlpnProvider.java:43)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> >> >> >> >> > Method)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> > java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>> >> >> >> >> >
>> >> >> >> >> > at java.lang.Class.newInstance(Class.java:442)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
>> >> >> >> >> >
>> >> >> >> >> > at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.<init>(ALPNManager.java:40)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.protocols.alpn.ALPNManager.<clinit>(ALPNManager.java:35)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.<init>(AlpnOpenListener.java:67)
>> >> >> >> >> >
>> >> >> >> >> > at
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > io.undertow.server.protocol.http.AlpnOpenListener.<init>(AlpnOpenListener.java:90)
>> >> >> >> >> >
>> >> >> >> >> > at io.undertow.Undertow.start(Undertow.java:179)
>> >> >> >> >> >
>> >> >> >> >> > at com.networknt.server.Server.start(Server.java:170)
>> >> >> >> >> >
>> >> >> >> >> > at com.networknt.server.Server.main(Server.java:90)
>> >> >> >> >> >
>> >> >> >> >> > 21:00:36.503 [main]  INFO  com.networknt.server.Server -
>> >> >> >> >> > Https
>> >> >> >> >> > Server
>> >> >> >> >> > started on ip:0.0.0.0 Port:8843
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > _______________________________________________
>> >> >> >> >> > undertow-dev mailing list
>> >> >> >> >> > undertow-dev at lists.jboss.org
>> >> >> >> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev
>> >> >> >> >
>> >> >> >> >
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>


More information about the undertow-dev mailing list