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 <sbor...@webtide.com>:

> Hi,
>
> On Mon, Feb 8, 2016 at 1:41 PM, John Jiang <john.sha.ji...@gmail.com>
> wrote:
> > Hi Simone,
> >
> > 2016-02-07 18:43 GMT+08:00 Simone Bordet <sbor...@webtide.com>:
> >>
> >> Hi,
> >>
> >> On Fri, Feb 5, 2016 at 6:30 AM, John Jiang <john.sha.ji...@gmail.com>
> >> 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
> jetty-users@eclipse.org
> 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
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to