curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Weird MAX_CONCURRENT_STREAMS value with empty HTTP/2 SETTINGS frame

From: Alexandre Pion via curl-users <curl-users_at_cool.haxx.se>
Date: Mon, 8 Jun 2020 14:37:51 +0200 (CEST)

Hi,

Thank you both for your replies.

> Seems like it might be a nghttp2 issue though, as it tells curl there's a
> settings frame and the curl code simply reads what nghttp2 told it...
>
> Is this reproducible against a public site?

It seems that <https://twitter.com> answers with an empty SETTINGS frame and curl/nghttp2 says it allows 4294967295 MAX_CONCURRENT_STREAMS (which is maybe true, but seems a lot compared to the value of ~100 concurrent streams seen on most other HTTP/2 servers).

% curl -v --http2 --output /dev/null https://twitter.com
...
* Using Stream ID: 1 (easy handle 0x55f48bccf040)
> GET / HTTP/2
> Host: twitter.com
> user-agent: curl/7.68.0
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 4294967295)!
< HTTP/2 200
...

% nghttp -nv https://twitter.com
[ 0.139] Connected
The negotiated protocol: h2
[ 0.371] recv SETTINGS frame <length=6, flags=0x00, stream_id=0>
          (niv=1)
          [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65536]
...
[ 0.372] send HEADERS frame <length=36, flags=0x25, stream_id=13>
          ; END_STREAM | END_HEADERS | PRIORITY
          (padlen=0, dep_stream_id=11, weight=16, exclusive=0)
          ; Open new stream
          :method: GET
          :path: /
          :scheme: https
          :authority: twitter.com
          accept: */*
          accept-encoding: gzip, deflate
          user-agent: nghttp2/1.36.0
[ 0.486] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
          ; ACK
          (niv=0)
[ 0.529] recv (stream_id=13) :status: 200
...

> The default max concurrent streams in nghttp2 is 4294967295.
> https://github.com/nghttp2/nghttp2/blob/v1.41.0/lib/nghttp2_session.c#L4425-L4429
> https://github.com/nghttp2/nghttp2/blob/v1.41.0/lib/nghttp2_session.h#L102-L103

Thanks for the links. I understand nghttp2 defines this value to UINT32_MAX, due to the fact that this is the maximum allowed by the RFC <https://github.com/nghttp2/nghttp2/commit/16c46114dc724278beaa6d59462f8396f35fa4a9>.

As I see it, the HTTP/2 server didn't explicitly send the number of MAX_CONCURRENT_STREAMS supported in a SETTINGS frame, so nghttp2 uses its default value (4294967295) and curl reads this value. I am right or did I miss something ?

Regards,

Alex
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-06-08