Don't use HTTP/2

This commit is contained in:
Neil Alexander 2021-03-16 09:54:09 +00:00
parent 3be9f6d5d6
commit 36f7a47e42
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 16 additions and 12 deletions

View file

@ -9,7 +9,6 @@ import (
"github.com/matrix-org/dendrite/setup"
"github.com/matrix-org/gomatrixserverlib"
"github.com/sirupsen/logrus"
"golang.org/x/net/http2"
pineconeRouter "github.com/matrix-org/pinecone/router"
pineconeSessions "github.com/matrix-org/pinecone/sessions"
@ -41,7 +40,7 @@ func ConnectToPeer(pRouter *pineconeRouter.Router, peer string) {
}
type RoundTripper struct {
inner *http2.Transport
inner *http.Transport
}
func (y *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
@ -55,9 +54,13 @@ func CreateClient(
tr := &http.Transport{}
tr.RegisterProtocol(
"matrix", &RoundTripper{
inner: &http2.Transport{
AllowHTTP: true,
DialTLS: s.DialTLSForH2C,
inner: &http.Transport{
MaxIdleConns: 100,
MaxIdleConnsPerHost: 5,
Dial: s.Dial,
DialContext: s.DialContext,
DialTLS: s.DialTLS,
DialTLSContext: s.DialTLSContext,
},
},
)
@ -72,9 +75,13 @@ func CreateFederationClient(
tr := &http.Transport{}
tr.RegisterProtocol(
"matrix", &RoundTripper{
inner: &http2.Transport{
AllowHTTP: true,
DialTLS: s.DialTLSForH2C,
inner: &http.Transport{
MaxIdleConns: 100,
MaxIdleConnsPerHost: 5,
Dial: s.Dial,
DialContext: s.DialContext,
DialTLS: s.DialTLS,
DialTLSContext: s.DialTLSContext,
},
},
)

View file

@ -47,8 +47,6 @@ import (
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/userapi"
"github.com/matrix-org/gomatrixserverlib"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
pineconeMulticast "github.com/matrix-org/pinecone/multicast"
pineconeRouter "github.com/matrix-org/pinecone/router"
@ -224,7 +222,6 @@ func main() {
pQUIC.Mux().Handle(httputil.PublicMediaPathPrefix, pMux)
// Build both ends of a HTTP multiplex.
h2s := &http2.Server{}
httpServer := &http.Server{
Addr: ":0",
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
@ -234,7 +231,7 @@ func main() {
BaseContext: func(_ net.Listener) context.Context {
return context.Background()
},
Handler: h2c.NewHandler(pMux, h2s),
Handler: pMux,
}
go func() {