The net/http package includes transparent support for HTTP/2. The source of truth for this implementation is the golang.org/x/net/http2 package, which is vendored into std (using a rather complicated process to avoid import cycles). The http2 package also exposes a number of configuration settings and features which are not directly accessible from net/http.
There were good reasons for starting development of the HTTP/2 implementation outside of std, but the current state of affairs is confusing and inconvenient. Backporting HTTP/2 fixes into minor releases is difficult. New versions of net/http need to support old versions of x/net. We can't make changes to the HTTP/1 and HTTP/2 implementations atomically. Users need to import an x/ package to configure HTTP/2 settings.
This issue is a tracking issue for moving HTTP/2 into std.
The desired end state is that the canonical HTTP/2 implementation used by net/http is located in the main Go repository and golang.org/x/net/http2 is deprecated.
The golang.org/x/net/http2 package has a substantial API surface. Some of that functionality (such as server and client configuration settings) will be made available via net/http, some will move into new packages, and some will be deprecated. The first stage of this project is to make every non-deprecated feature of golang.org/x/net/http2 available elsewhere.
(Original discussion: #60746)
The
net/httppackage includes transparent support for HTTP/2. The source of truth for this implementation is thegolang.org/x/net/http2package, which is vendored intostd(using a rather complicated process to avoid import cycles). Thehttp2package also exposes a number of configuration settings and features which are not directly accessible fromnet/http.There were good reasons for starting development of the HTTP/2 implementation outside of
std, but the current state of affairs is confusing and inconvenient. Backporting HTTP/2 fixes into minor releases is difficult. New versions ofnet/httpneed to support old versions ofx/net. We can't make changes to the HTTP/1 and HTTP/2 implementations atomically. Users need to import an x/ package to configure HTTP/2 settings.This issue is a tracking issue for moving HTTP/2 into
std.The desired end state is that the canonical HTTP/2 implementation used by
net/httpis located in the main Go repository andgolang.org/x/net/http2is deprecated.The
golang.org/x/net/http2package has a substantial API surface. Some of that functionality (such as server and client configuration settings) will be made available vianet/http, some will move into new packages, and some will be deprecated. The first stage of this project is to make every non-deprecated feature ofgolang.org/x/net/http2available elsewhere.(Original discussion: #60746)