cURL cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1482 http2 does not connection over "http://" unless the endpoint supports promotion from http1 to http2

From: Charles <drcrallen_at_users.sf.net>
Date: Fri, 20 Feb 2015 15:35:49 +0000

Did you mean that don't support HTTP/1.1 ?

I have not tried any other servers. Here is the report from the server logs on supported protocols:

~~~~~~~~~~
org.eclipse.jetty.server.ServerConnector - Started ServerConnector_at_184f6cea{h2-17,[h2-17, h2-16, h2-15, h2-14, h2]}{0.0.0.0:8081}
~~~~~~~~~~

Notably http1.1 is lacking, which is added if I change the connection factory chain to something like:

~~~~~~~~~~~~
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig), new HTTP2CServerConnectionFactory(httpConfig), new HTTP2ServerConnectionFactory(httpConfig));
~~~~~~~~~~~~

Which gives:
~~~~~~~~~~~~
org.eclipse.jetty.server.ServerConnector - Started ServerConnector_at_763812b1{HTTP/1.1,[http/1.1, h2c-17, h2c-16, h2c-15, h2c-14, h2c, h2-17, h2-16, h2-15, h2-14, h2]}{0.0.0.0:8081}
~~~~~~~~~~~~

I *suspect* that the curl version is trying to do http/1.1-->http/2 promotion, whereas the nghttp jumps into assumed prior knowledge of http/2 or some similar assumption of protocol. But honestly I'm not as familiar with reading http/1.1 or http/2 handshaking to say for certain.

---
** [bugs:#1482] http2 does not connection over "http://" unless the endpoint supports promotion from http1 to http2**
**Status:** open
**Created:** Fri Feb 20, 2015 01:59 AM UTC by Charles
**Last Updated:** Fri Feb 20, 2015 09:39 AM UTC
**Owner:** Daniel Stenberg
I have a jetty server running the latest RC, and I have the servlet configured by:
ServerConnector connector = new ServerConnector(server, new HTTP2ServerConnectionFactory(httpConfig));
Using curl-7_40_0 with libnghttp2 v0.7.3, I get the following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ ./src/curl -v --http2 "http://localhost:8081/status"
*   Trying ::1...
* Connected to localhost (::1) port 8081 (#0)
* Using HTTP2
> GET /status HTTP/1.1
> User-Agent: curl/7.40.0-DEV
> Host: localhost:8081
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c-14
> HTTP2-Settings: AAMAAABkAAQAAP__
>
* Connection #0 to host localhost left intact
invalid_preface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But using nghttp v0.7.3 directly I get:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ nghttp -v http://localhost:8081/status
[  0.001] Connected
[  0.001] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
          (niv=2)
          [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
          [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[  0.001] send HEADERS frame <length=39, flags=0x05, stream_id=1>
          ; END_STREAM | END_HEADERS
          (padlen=0)
          ; Open new stream
          :method: GET
          :path: /status
          :scheme: http
          :authority: localhost:8081
          accept: */*
          accept-encoding: gzip, deflate
          user-agent: nghttp2/0.7.3
[  0.002] recv SETTINGS frame <length=12, flags=0x00, stream_id=0>
          (niv=2)
          [SETTINGS_HEADER_TABLE_SIZE(0x01):4096]
          [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[  0.002] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
          ; ACK
          (niv=0)
[  0.002] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
          ; ACK
          (niv=0)
[  0.004] recv (stream_id=1, noind=0) :status: 200
[  0.004] recv (stream_id=1, noind=0) server: Jetty(9.3.0-SNAPSHOT)
[  0.004] recv (stream_id=1, noind=0) date: Fri, 20 Feb 2015 01:54:11 GMT
[  0.004] recv (stream_id=1, noind=0) content-type: application/json
[  0.004] recv HEADERS frame <length=58, flags=0x04, stream_id=1>
          ; END_HEADERS
          (padlen=0)
          ; First response header
{"version":null,"modules":[{"name":"io.druid.query.aggregation.histogram.ApproximateHistogramDruidModule","artifact":"druid-histogram","version":"0.7.0-SNAPSHOT"}],"memory":{"maxMemory":4294967296,"totalMemory":268435456,"freeMemory":197976688,"usedMemory":70458768}}[  0.004] recv DATA frame <length=267, flags=0x00, stream_id=1>
[  0.004] recv DATA frame <length=0, flags=0x01, stream_id=1>
          ; END_STREAM
[  0.004] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
          (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using nghttp directly returns the correct result whereas curl --http2 does not.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2015-02-20

These mail archives are generated by hypermail.