Skip to content
This repository was archived by the owner on Jul 6, 2018. It is now read-only.
This repository was archived by the owner on Jul 6, 2018. It is now read-only.

a better default configuration for TLS connection of http2 #59

Description

@jmuk

It seems the TLS socket is initialized as tls.connect(port, host, options) in http2.connect. Some existing HTTP2 servers require some TLS options to set up the connection properly. More specifically:

  • servername (for Server Name Indication)
  • ALPN / NPN, specifying 'h2'

I believe those should be set by defaults, then passing a URL string will just work.

Also, maybe it's better to use secureConnect event instead of connect event for the TLS sockets for setting up a session -- so that it won't go into the session if some TLS setup failure happens.

Activity

  1. jasnell commented on May 2, 2017

    @jasnell
    Member

    The ALPN/NPN bit should already be handled internally by the code. If it's not, then that's definitely a bug. For the SNI, that should be able to be passed in on the options but I haven't tested it yet.

  2. jmuk commented on May 2, 2017

    @jmuk
    ContributorAuthor

    I think you're talking about the servers, but I was talking about the clients (sorry I wasn't clear).

    The http2 client sockets are initialized around https://github.com/nodejs/http2/blob/master/lib/internal/http2/core.js#L1238 but no ALPN/NPN are specified yet, if I understand correctly.

    SNI can be specified through options indeed, but (for the clients) I think it's better to specify the host name by default, otherwise an http2 connection request will look like http2.connect("https://http2.golang.org/", {servername: 'http2.golang.org'}) which are really redundant.

  3. jasnell commented on May 2, 2017

    @jasnell
    Member

    Ok. I'll verify shortly and will make the sni change. Thank you!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions