Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
c0b opened this issue Oct 29, 2017 · 3 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. http2 Issues or PRs related to the http2 subsystem. question Issues that look for answers.

Comments

@c0b
Copy link
Contributor

c0b commented Oct 29, 2017

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' }
@c0b
Copy link
Contributor Author

c0b commented Oct 29, 2017

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

@addaleax addaleax added duplicate Issues and PRs that are duplicates of other issues or PRs. http2 Issues or PRs related to the http2 subsystem. question Issues that look for answers. labels Oct 29, 2017
@addaleax
Copy link
Member

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

@c0b
Copy link
Contributor Author

c0b commented Oct 29, 2017

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

@c0b c0b closed this as completed Oct 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. http2 Issues or PRs related to the http2 subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

2 participants