mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
crypto/tls: clarify documentation on tls.Config.NextProtos
This change will aid users to make less mistakes where you, for example, define both HTTP/1.1 and H2, but in the wrong order.
package main
import (
"crypto/tls"
"net"
)
func main() {
srv := &http.Server{
TLSConfig: &tls.Config{
NextProtos: []string{"http/1.1", "h2"},
},
}
srv.ListenAndServeTLS("server.crt", "server.key")
}
When using major browsers or curl, they will never be served H2 since they also support HTTP/1.0 and the list is processed in order.
Change-Id: Id14098b5e48f624ca308137917874d475c2f22a0
GitHub-Last-Rev: f3594a6411
GitHub-Pull-Request: golang/go#28367
Reviewed-on: https://go-review.googlesource.com/c/144387
Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
parent
455ef3f6bc
commit
7bada2cf46
1 changed files with 2 additions and 1 deletions
|
|
@ -424,7 +424,8 @@ type Config struct {
|
||||||
// If RootCAs is nil, TLS uses the host's root CA set.
|
// If RootCAs is nil, TLS uses the host's root CA set.
|
||||||
RootCAs *x509.CertPool
|
RootCAs *x509.CertPool
|
||||||
|
|
||||||
// NextProtos is a list of supported, application level protocols.
|
// NextProtos is a list of supported application level protocols, in
|
||||||
|
// order of preference.
|
||||||
NextProtos []string
|
NextProtos []string
|
||||||
|
|
||||||
// ServerName is used to verify the hostname on the returned
|
// ServerName is used to verify the hostname on the returned
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue