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

Misleading HTTP2 authority documentation #31827

Description

@szmarczak

http2.connect(authority[, options][, listener])

According to the HTTP2 spec:

The :authority pseudo-header field includes the authority portion of the target URI ([RFC3986], Section 3.2). The authority MUST NOT include the deprecated userinfo subcomponent for http or https schemed URIs.

authority = [ userinfo "@" ] host [ ":" port ]

So running http2.connect('google.com') should work, but it doesn't:

TypeError [ERR_INVALID_URL]: Invalid URL: google.com

I believe that it should be http2.connect(origin[, options][, listener]).
For example, url.origin returns protocol://authority.

Activity

  1. jasnell commented on Feb 17, 2020

    @jasnell
    Member

    The API requires the https:// or http:// prefix. So it should be http2.connect('https://google.com'). The documentation needs to be clearer on this.

  2. jasnell commented on Feb 17, 2020

    @jasnell
    Member

    PR to clarify docs: #31828

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