Skip to content

http2 client: fallback to HTTP/1.1 ? or how can a http client library gracefully support both http2 and http1 servers? #16597

Closed

Description

@c0b

I filed nodejs/http2#189 but seems no discussions at all, wonder is it possible for a http client library gracefully support both http2 and http1 servers? I want the client library to prefer connect by http2, then fallback to http1; I've tried current http2.connect but seems unable to connect if a server does not support http2? current behavior of http2.connect("https://some-no-http2-server") is returned a http2session but got destroyed after tried connection; so the solution I can think of is to use a http2session close event listener if closed almost immediately can try fallback to http1; however this won't be efficient; wonder anyone has better ideas?

$ node -p process.versions
{ http_parser: '2.7.0',
  node: '8.8.1',
  v8: '6.1.534.42',
  uv: '1.15.0',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  modules: '57',
  nghttp2: '1.25.0',
  openssl: '1.0.2l',
  icu: '59.1',
  unicode: '9.0',
  cldr: '31.0.1',
  tz: '2017b' }

Activity

  1. c0b commented on Oct 29, 2017

    @c0b
    ContributorAuthor

    since server side has nodejs/http2#125 http2: ALPN fallback to HTTP/1.1 can we have similar API for the http2 client session?

  2. added
    duplicateIssues and PRs that are duplicates of other issues or PRs.
    http2Issues and PRs related to the http2 subsystem.
    questionIssues asking questions about Node.js.
    on Oct 29, 2017
  3. addaleax commented on Oct 29, 2017

    @addaleax
    Member

    I think this is essentially the same issue as #16256, right?

  4. c0b commented on Oct 29, 2017

    @c0b
    ContributorAuthor

    connect to support the allowHTTP1 setting and open a PR. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.http2Issues and PRs related to the http2 subsystem.questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions