-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates activator to support h2c (#1260)
- Loading branch information
1 parent
2ba8e0c
commit 8cac18c
Showing
17 changed files
with
1,147 additions
and
268 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package h2c | ||
|
||
import ( | ||
"crypto/tls" | ||
"net" | ||
"net/http" | ||
|
||
"golang.org/x/net/http2" | ||
) | ||
|
||
// NewTransport will reroute all https traffic to http. This is | ||
// to explicitly allow h2c (http2 without TLS) transport. | ||
// See https://github.com/golang/go/issues/14141 for more details. | ||
func NewTransport() http.RoundTripper { | ||
return &http2.Transport{ | ||
AllowHTTP: true, | ||
DialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) { | ||
return net.Dial(netw, addr) | ||
}, | ||
} | ||
} |
Oops, something went wrong.