【问题标题】:Should the HTTP/2 `:authority` header include port number?HTTP/2 `:authority` 标头是否应该包含端口号?
【发布时间】:2018-10-06 16:04:07
【问题描述】:

Is Port Number Required in HTTP "Host" Header Parameter? 开始,相同的逻辑是否适用于 HTTP/2?

即如果浏览器向https://server.com:1234/ 发出请求,那么:authority 标头应该是server.com 还是server.com:1234

【问题讨论】:

    标签: http2


    【解决方案1】:

    应该,:authority 由 RFC 7540 (https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2.3) 定义为:

    pseudo-header 字段包括目标 URI 的权限部分([RFC3986],第 3.2 节)。权限不得包含“http”或“https”方案 URI 的已弃用“userinfo”子组件。

    RFC 3986 又将权限描述为:

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

    所以是的,如果端口不是方案的默认端口,它应该包括端口。

    【讨论】:

      猜你喜欢
      • 2012-12-08
      • 2010-12-07
      • 2011-03-22
      • 1970-01-01
      • 2021-01-25
      • 2012-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多