Jetty HTTP/2 server talks with HTTP/1 client?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Jetty HTTP/2 server talks with HTTP/1 client?

John Jiang
Hi guys,
It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1 client (org.eclipse.jetty.client.HttpClient).
The error likes: Illegal character 0x0 in state=START for buffer...

But the HTTP/1 client can access Apache HTTP/2 server.

Is there any way to resolve/workaround this problem on Jetty server side?
Thanks!

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

Jesse McConnell
do you have the http/1 connection configured as well? it needs something to fall back to if http/2 isn't present

--
jesse mcconnell
[hidden email]

On Thu, Feb 4, 2016 at 11:30 PM, John Jiang <[hidden email]> wrote:
Hi guys,
It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1 client (org.eclipse.jetty.client.HttpClient).
The error likes: Illegal character 0x0 in state=START for buffer...

But the HTTP/1 client can access Apache HTTP/2 server.

Is there any way to resolve/workaround this problem on Jetty server side?
Thanks!

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

John Jiang
Hi,

2016-02-05 22:34 GMT+08:00 Jesse McConnell <[hidden email]>:
do you have the http/1 connection configured as well? it needs something to fall back to if http/2 isn't present
I'm using standalone Jetty server with HTTP/2 related modules, and haven't any special configuration for HTTP/1.
I suppose HTTP/1 is supported by default.

When my Jetty server started, I got the below log:
2016-02-06 17:16:13.757:INFO:oejs.ServerConnector:main: Started ServerConnector@b3d7190{HTTP/1.1,[http/1.1, h2c, h2c-17, h2c-16, h2c-15, h2c-14]}{0.0.0.0:9000}

Do I have to configure any more?

Thanks!
 

--
jesse mcconnell
[hidden email]

On Thu, Feb 4, 2016 at 11:30 PM, John Jiang <[hidden email]> wrote:
Hi guys,
It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1 client (org.eclipse.jetty.client.HttpClient).
The error likes: Illegal character 0x0 in state=START for buffer...

But the HTTP/1 client can access Apache HTTP/2 server.

Is there any way to resolve/workaround this problem on Jetty server side?
Thanks!

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

Simone Bordet-3
Hi,

On Fri, Feb 5, 2016 at 6:30 AM, John Jiang <[hidden email]> wrote:
> Hi guys,
> It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1 client
> (org.eclipse.jetty.client.HttpClient).
> The error likes: Illegal character 0x0 in state=START for buffer...

If you get this error, you are not using a HTTP/1.1 client to connect
to the server, but a HTTP/2 client.

> But the HTTP/1 client can access Apache HTTP/2 server.

Apache HTTP/2 server ?

At this point you have to explain what is your setup because it's not clear.

On Sat, Feb 6, 2016 at 10:21 AM, John Jiang <[hidden email]> wrote:

> Hi,
>
> 2016-02-05 22:34 GMT+08:00 Jesse McConnell <[hidden email]>:
>>
>> do you have the http/1 connection configured as well? it needs something
>> to fall back to if http/2 isn't present
>
> I'm using standalone Jetty server with HTTP/2 related modules, and haven't
> any special configuration for HTTP/1.
> I suppose HTTP/1 is supported by default.
>
> When my Jetty server started, I got the below log:
> 2016-02-06 17:16:13.757:INFO:oejs.ServerConnector:main: Started
> ServerConnector@b3d7190{HTTP/1.1,[http/1.1, h2c, h2c-17, h2c-16, h2c-15,
> h2c-14]}{0.0.0.0:9000}

This configuration will be able to accept plain HTTP/1.1 requests, and
HTTP/1.1 upgrade requests to HTTP/2.

> Do I have to configure any more?

You have to explain in more details what you're doing.
You mention clients but not how they are configured, you mention
Jetty, you mention Apache HTTP/2 server...
Difficult to help you out without more detailed information.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

John Jiang
Hi Simone,

2016-02-07 18:43 GMT+08:00 Simone Bordet <[hidden email]>:
Hi,

On Fri, Feb 5, 2016 at 6:30 AM, John Jiang <[hidden email]> wrote:
> Hi guys,
> It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1 client
> (org.eclipse.jetty.client.HttpClient).
> The error likes: Illegal character 0x0 in state=START for buffer...

If you get this error, you are not using a HTTP/1.1 client to connect
to the server, but a HTTP/2 client.
The following is my test method,
public void tes() throws Exception, InterruptedException,
            ExecutionException, TimeoutException {
    SslContextFactory sslContextFactory = new SslContextFactory();
    sslContextFactory.setSslContext(...);
    String url = ...;
    HttpClient client = new HttpClient(sslContextFactory);
    client.start();
    HttpRequest request = (HttpRequest) client.newRequest(url);
    System.out.println(request);
    ContentResponse response = request.send();
    System.out.println(response.getStatus());
    client.stop();
}

I think I'm using HTTP/1.1 client.
 

> But the HTTP/1 client can access Apache HTTP/2 server.

Apache HTTP/2 server ?

At this point you have to explain what is your setup because it's not clear.
I'm also using an Apache server, which supports HTTP/2 with mod_http2.
 

On Sat, Feb 6, 2016 at 10:21 AM, John Jiang <[hidden email]> wrote:
> Hi,
>
> 2016-02-05 22:34 GMT+08:00 Jesse McConnell <[hidden email]>:
>>
>> do you have the http/1 connection configured as well? it needs something
>> to fall back to if http/2 isn't present
>
> I'm using standalone Jetty server with HTTP/2 related modules, and haven't
> any special configuration for HTTP/1.
> I suppose HTTP/1 is supported by default.
>
> When my Jetty server started, I got the below log:
> 2016-02-06 17:16:13.757:INFO:oejs.ServerConnector:main: Started
> ServerConnector@b3d7190{HTTP/1.1,[http/1.1, h2c, h2c-17, h2c-16, h2c-15,
> h2c-14]}{0.0.0.0:9000}

This configuration will be able to accept plain HTTP/1.1 requests, and
HTTP/1.1 upgrade requests to HTTP/2.

> Do I have to configure any more?

You have to explain in more details what you're doing.
You mention clients but not how they are configured, you mention
Jetty, you mention Apache HTTP/2 server...
Difficult to help you out without more detailed information.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

Simone Bordet-3
Hi,

On Mon, Feb 8, 2016 at 1:41 PM, John Jiang <[hidden email]> wrote:

> Hi Simone,
>
> 2016-02-07 18:43 GMT+08:00 Simone Bordet <[hidden email]>:
>>
>> Hi,
>>
>> On Fri, Feb 5, 2016 at 6:30 AM, John Jiang <[hidden email]>
>> wrote:
>> > Hi guys,
>> > It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1
>> > client
>> > (org.eclipse.jetty.client.HttpClient).
>> > The error likes: Illegal character 0x0 in state=START for buffer...
>>
>> If you get this error, you are not using a HTTP/1.1 client to connect
>> to the server, but a HTTP/2 client.
>
> The following is my test method,
> public void tes() throws Exception, InterruptedException,
>             ExecutionException, TimeoutException {
>     SslContextFactory sslContextFactory = new SslContextFactory();
>     sslContextFactory.setSslContext(...);
>     String url = ...;
>     HttpClient client = new HttpClient(sslContextFactory);
>     client.start();
>     HttpRequest request = (HttpRequest) client.newRequest(url);
>     System.out.println(request);
>     ContentResponse response = request.send();
>     System.out.println(response.getStatus());
>     client.stop();
> }
>
> I think I'm using HTTP/1.1 client.

Lots of stuff omitted, but you are using HTTP/1.1.
Does this request hit Jetty or does it hit Apache ?
Are you sure that the TLS setup is ok ?
We have many tests in the Jetty test suite that are setup in the same
way, and they work fine, so if you can post both client and server
full code will be easier to help you.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

John Jiang
Hi,
Sorry for the late reply.

Please allow me to describe more clearly.

1. When my Jetty 9.3.5 server started, the below logs were shown,
2016-03-31 15:55:07.476:INFO:oejs.ServerConnector:main: Started ServerConnector@10d59286{HTTP/1.1,[http/1.1, h2c, h2c-17, h2c-16, h2c-15, h2c-14]}{0.0.0.0:8080}
2016-03-31 15:55:08.699:INFO:oejus.SslContextFactory:main: x509=X509@5123a213(1,h=[sc11136070.us.oracle.com],w=[]) for SslContextFactory@52525845(...)
2016-03-31 15:55:12.725:INFO:oejs.ServerConnector:main: Started ServerConnector@4be242d9{SSL,[ssl, alpn, h2, h2-17, h2-16, h2-15, h2-14, http/1.1]}{0.0.0.0:8081}
2016-03-31 15:55:12.726:INFO:oejs.Server:main: Started @23362ms

I think it means that the server supports HTTP/2 with/without TLS. Right?

2. I used the following test codes,
public void testHttp() throws Exception, InterruptedException,
        ExecutionException, TimeoutException {
    String url = "https://localhost:8081";
    HttpClient client = new HttpClient(sslContextFactory); // This SSL setup has no problem.
    client.start();
    HttpRequest request = (HttpRequest) client.newRequest(url);
    System.out.println(request);
    ContentResponse response = request.send();
    System.out.println(response.getStatus());
    client.stop();
}

And I got the below output:
2016-03-31 16:31:55.450:INFO::main: Logging initialized @522ms
HttpRequest[GET  HTTP/1.1]@64bfbc86
2016-03-31 16:31:57.556:WARN:oejh.HttpParser:HttpClient@32374789-14: Illegal character 0x0 in state=START for buffer DirectByteBuffer@5684296a[p=1,l=32,c=16384,r=31]={\x00<<<\x00\x17\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01invalid_preface>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2016-03-31 16:31:57.557:WARN:oejh.HttpParser:HttpClient@32374789-14: bad HTTP parsed: 400 Illegal character 0x0 for HttpReceiverOverHTTP@1e0934bd(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]
Exception in thread "main" java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: bad response on HttpConnectionOverHTTP@53cf69a8(l:/127.0.0.1:62179 <-> r:localhost/127.0.0.1:8081,closed=false)[HttpChannelOverHTTP@51de0582(exchange=HttpExchange@32b0a780 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@654bd1b7(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@4d61769f{s=START}],recv=HttpReceiverOverHTTP@1e0934bd(rsp=IDLE,failure=null)[HttpParser{s=CLOSE,0 of 0}]]]
    at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)
    at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101)
    at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:653)
    at JettyClientTest.testHttp(JettyClientTest.java:44)
    at JettyClientTest.main(JettyClientTest.java:105)
Caused by: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: bad response on HttpConnectionOverHTTP@53cf69a8(l:/127.0.0.1:62179 <-> r:localhost/127.0.0.1:8081,closed=false)[HttpChannelOverHTTP@51de0582(exchange=HttpExchange@32b0a780 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@654bd1b7(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@4d61769f{s=START}],recv=HttpReceiverOverHTTP@1e0934bd(rsp=IDLE,failure=null)[HttpParser{s=CLOSE,0 of 0}]]]
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.badMessage(HttpReceiverOverHTTP.java:285)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1288)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:156)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:117)
    at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:69)
    at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:90)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:112)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:192)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
    at java.lang.Thread.run(Thread.java:745)

3. If just access HTTP, namely using url = "http://localhost:8080", the output is 200, which is normal.

2016-02-11 16:26 GMT+08:00 Simone Bordet <[hidden email]>:
Hi,

On Mon, Feb 8, 2016 at 1:41 PM, John Jiang <[hidden email]> wrote:
> Hi Simone,
>
> 2016-02-07 18:43 GMT+08:00 Simone Bordet <[hidden email]>:
>>
>> Hi,
>>
>> On Fri, Feb 5, 2016 at 6:30 AM, John Jiang <[hidden email]>
>> wrote:
>> > Hi guys,
>> > It seems that Jetty HTTP/2 server cannot be connected via its HTTP/1
>> > client
>> > (org.eclipse.jetty.client.HttpClient).
>> > The error likes: Illegal character 0x0 in state=START for buffer...
>>
>> If you get this error, you are not using a HTTP/1.1 client to connect
>> to the server, but a HTTP/2 client.
>
> The following is my test method,
> public void tes() throws Exception, InterruptedException,
>             ExecutionException, TimeoutException {
>     SslContextFactory sslContextFactory = new SslContextFactory();
>     sslContextFactory.setSslContext(...);
>     String url = ...;
>     HttpClient client = new HttpClient(sslContextFactory);
>     client.start();
>     HttpRequest request = (HttpRequest) client.newRequest(url);
>     System.out.println(request);
>     ContentResponse response = request.send();
>     System.out.println(response.getStatus());
>     client.stop();
> }
>
> I think I'm using HTTP/1.1 client.

Lots of stuff omitted, but you are using HTTP/1.1.
Does this request hit Jetty or does it hit Apache ?
Are you sure that the TLS setup is ok ?
We have many tests in the Jetty test suite that are setup in the same
way, and they work fine, so if you can post both client and server
full code will be easier to help you.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

Simone Bordet-3
Hi,

On Thu, Mar 31, 2016 at 10:44 AM, John Jiang <[hidden email]> wrote:
> Hi,
> Sorry for the late reply.
>
> Please allow me to describe more clearly.
>
> 1. When my Jetty 9.3.5 server started, the below logs were shown,
> 2016-03-31 15:55:07.476:INFO:oejs.ServerConnector:main: Started
> ServerConnector@10d59286{HTTP/1.1,[http/1.1, h2c, h2c-17, h2c-16, h2c-15,
> h2c-14]}{0.0.0.0:8080}

This connector speaks HTTP/1.1 and will be able to speak HTTP/2
clear-text (h2c) when an upgrade is performed.

> 2016-03-31 15:55:08.699:INFO:oejus.SslContextFactory:main:
> x509=X509@5123a213(1,h=[sc11136070.us.oracle.com],w=[]) for
> SslContextFactory@52525845(...)
> 2016-03-31 15:55:12.725:INFO:oejs.ServerConnector:main: Started
> ServerConnector@4be242d9{SSL,[ssl, alpn, h2, h2-17, h2-16, h2-15, h2-14,
> http/1.1]}{0.0.0.0:8081}

This connector speaks SSL, it is configured with ALPN, so will be able
to speak HTTP/2 and HTTP/1.1 based on the ALPN protocol negotiated.

> 2016-03-31 15:55:12.726:INFO:oejs.Server:main: Started @23362ms
>
> I think it means that the server supports HTTP/2 with/without TLS. Right?

Correct.

> 2. I used the following test codes,
> public void testHttp() throws Exception, InterruptedException,
>         ExecutionException, TimeoutException {
>     String url = "https://localhost:8081";
>     HttpClient client = new HttpClient(sslContextFactory); // This SSL setup
> has no problem.

You are using the HTTP/1.1 transport here, so no HTTP/2 from the client.

>     client.start();
>     HttpRequest request = (HttpRequest) client.newRequest(url);
>     System.out.println(request);
>     ContentResponse response = request.send();
>     System.out.println(response.getStatus());
>     client.stop();
> }
>
> And I got the below output:
> 2016-03-31 16:31:55.450:INFO::main: Logging initialized @522ms
> HttpRequest[GET  HTTP/1.1]@64bfbc86
> 2016-03-31 16:31:57.556:WARN:oejh.HttpParser:HttpClient@32374789-14: Illegal
> character 0x0 in state=START for buffer
> DirectByteBuffer@5684296a[p=1,l=32,c=16384,r=31]={\x00<<<\x00\x17\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01invalid_preface>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}

So, the client sent a HTTP/1.1 request, and the server replied with a
HTTP/2 GOAWAY frame saying "invalid_preface".

You are not using ALPN on the client, so this tells me that you have
chosen HTTP/2 to be the default protocol on the server.

What you want to do is to tell the ALPN ConnectionFactory what is the
default protocol. In your case it should be "http/1.1".
See ALPNServerConnectionFactory.setDefaultProtocol(String).

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Jetty HTTP/2 server talks with HTTP/1 client?

John Jiang
Hi,
I setup a jetty-alpn.xml, and set the default protocol for ALPNServerConnectionFactory.
Now, it works.

Thanks!

2016-03-31 17:01 GMT+08:00 Simone Bordet <[hidden email]>:
Hi,

On Thu, Mar 31, 2016 at 10:44 AM, John Jiang <[hidden email]> wrote:
> Hi,
> Sorry for the late reply.
>
> Please allow me to describe more clearly.
>
> 1. When my Jetty 9.3.5 server started, the below logs were shown,
> 2016-03-31 15:55:07.476:INFO:oejs.ServerConnector:main: Started
> ServerConnector@10d59286{HTTP/1.1,[http/1.1, h2c, h2c-17, h2c-16, h2c-15,
> h2c-14]}{0.0.0.0:8080}

This connector speaks HTTP/1.1 and will be able to speak HTTP/2
clear-text (h2c) when an upgrade is performed.

> 2016-03-31 15:55:08.699:INFO:oejus.SslContextFactory:main:
> x509=X509@5123a213(1,h=[sc11136070.us.oracle.com],w=[]) for
> SslContextFactory@52525845(...)
> 2016-03-31 15:55:12.725:INFO:oejs.ServerConnector:main: Started
> ServerConnector@4be242d9{SSL,[ssl, alpn, h2, h2-17, h2-16, h2-15, h2-14,
> http/1.1]}{0.0.0.0:8081}

This connector speaks SSL, it is configured with ALPN, so will be able
to speak HTTP/2 and HTTP/1.1 based on the ALPN protocol negotiated.

> 2016-03-31 15:55:12.726:INFO:oejs.Server:main: Started @23362ms
>
> I think it means that the server supports HTTP/2 with/without TLS. Right?

Correct.

> 2. I used the following test codes,
> public void testHttp() throws Exception, InterruptedException,
>         ExecutionException, TimeoutException {
>     String url = "https://localhost:8081";
>     HttpClient client = new HttpClient(sslContextFactory); // This SSL setup
> has no problem.

You are using the HTTP/1.1 transport here, so no HTTP/2 from the client.

>     client.start();
>     HttpRequest request = (HttpRequest) client.newRequest(url);
>     System.out.println(request);
>     ContentResponse response = request.send();
>     System.out.println(response.getStatus());
>     client.stop();
> }
>
> And I got the below output:
> 2016-03-31 16:31:55.450:INFO::main: Logging initialized @522ms
> HttpRequest[GET  HTTP/1.1]@64bfbc86
> 2016-03-31 16:31:57.556:WARN:oejh.HttpParser:HttpClient@32374789-14: Illegal
> character 0x0 in state=START for buffer
> DirectByteBuffer@5684296a[p=1,l=32,c=16384,r=31]={\x00<<<\x00\x17\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01invalid_preface>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}

So, the client sent a HTTP/1.1 request, and the server replied with a
HTTP/2 GOAWAY frame saying "invalid_preface".

You are not using ALPN on the client, so this tells me that you have
chosen HTTP/2 to be the default protocol on the server.

What you want to do is to tell the ALPN ConnectionFactory what is the
default protocol. In your case it should be "http/1.1".
See ALPNServerConnectionFactory.setDefaultProtocol(String).

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users