Documentation
¶
Overview ¶
Package h2c is deprecated.
This package used to support unencrypted HTTP/2. Unencrypted HTTP/2 is now supported directly by the net/http package.
To start a server with unencrypted HTTP/2 support:
srv := &http.Server{Addr: address}
srv.Protocols = new(http.Protocols)
srv.Protocols.SetHTTP1(true)
srv.Protocols.SetUnencryptedHTTP2(true)
srv.ListenAndServe()
To use HTTP/2 for unencrypted client requests:
tr := &http.Transport{}
tr.Protocols = new(http.Protocols)
tr.Protocols.SetUnencryptedHTTP2(true)
client := &http.Client{Transport: tr}
Deprecated: This package is deprecated.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler
deprecated
NewHandler is deprecated.
Deprecated: Set the http.Server Protocols field to use unencrypted HTTP/2 instead.
Example ¶
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello world")
})
h2s := &http2.Server{
// ...
}
h1s := &http.Server{
Addr: ":8080",
Handler: NewHandler(handler, h2s),
}
log.Fatal(h1s.ListenAndServe())
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.