镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Need backward compatibility to use http1 on Http2Server #18554

Closed

Description

@trivikr
  • Version: 9.5.0 (Current)
  • Platform: Any
  • Subsystem: http2

Details:

  • I was experimenting with http2 on fastify NodeJS Server by following this doc
  • Once http2 is out of experimental phase in Node v10, I'm planning to use its plain text version for communication between microservices.
  • For backward compatibility, I noticed that http2 allows http1 connection for Http2SecureServer
    if (options.allowHTTP1 === true)
    return httpConnectionListener.call(this, socket);
  • However, I couldn't find an option to pass allowHTTP1 in options for Http2Server
    class Http2Server extends NETServer {

Since microservices are updated independently of each other, we need a way to provide backward compatibility for http2 plain text server. Is there a plan to provide such option for Http2Server?

Activity

  1. trivikr commented on Feb 8, 2018

    @trivikr
    MemberAuthor

    Any update on this request?

  2. devsnek commented on Feb 8, 2018

    @devsnek
    Member

    cc @nodejs/http2

  3. added
    httpIssues and PRs related to the http subsystem.
    feature requestIssues requesting new Node.js features.
    http2Issues and PRs related to the http2 subsystem.
    on Feb 8, 2018
  4. jasnell commented on Feb 8, 2018

    @jasnell
    Member

    This is not yet possible with plain text http2 because the fallback mechanism depends entirely on the use of the ALPN tls extension.

    Working on this is not currently in plan for me but I'm happy to review PRs if anyone wants to tackle it

  5. trivikr commented on Feb 8, 2018

    @trivikr
    MemberAuthor

    I'd written some unit tests for NodeJS HTTP/2 in the past, and have an idea about how core.js works.
    I can take this up. Any tips/suggestions on where to start wrt ALPN?

  6. mcollina commented on Feb 8, 2018

    @mcollina
    SponsorMember

    Any tips/suggestions on where to start wrt ALPN?

    ALPN is already supported, it is the mechanism to support both HTTP/1.1 and HTTP/2 over the secure channel. Basically ALPN is used to kickstart the connection.

    Upgrading from a plain text HTTP1 to HTTP2 would mean to use a similar flow to what is used for websockets (check out https://www.npmjs.com/package/ws) to upgrade the socket.
    It might very well be possible that this flow could happen 80% in the ecosystem but we would need a little bit of support from Node core. This would be my preferred path.
    I'm also ok in implement it fully within Node.js itself.

  7. jasnell commented on Aug 10, 2018

    @jasnell
    Member

    At this point in time, there's really no plan to implement this in core. The current implementation should not preclude anyone from providing an implementation that uses a similar http/1 upgrade path as is used by bootstrapping websockets.

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

    feature requestIssues requesting new Node.js features.httpIssues and PRs related to the http subsystem.http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions