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: Daniel Stenberg <bagder_at_users.sf.net>
Date: Fri, 20 Feb 2015 15:43:19 +0000

I tried curl with --http2 against servers that speak and and those that don't speak HTTP/2 and they work for me. So I'm not sure what jetty does that makes it not work. You can try curl against http://nghttp2.org/ to see a clear text request.

In a clear text 1.1-request, curl tells the server it can upgrade to 2 if it knows how to and it is then supposed to send back the proper "101 protocol switching" if it does.

Your dump seems to indicate that jetty doesn't upgrade at all but as you say, assumes http/2 from the start. curl doesn't (yet) support prior-knowledge clear text http2 but that's something I'd like to add support for...

---
** [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 03:35 PM 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.