mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Don't use HTTP/2
This commit is contained in:
parent
3be9f6d5d6
commit
36f7a47e42
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/matrix-org/dendrite/setup"
|
"github.com/matrix-org/dendrite/setup"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/net/http2"
|
|
||||||
|
|
||||||
pineconeRouter "github.com/matrix-org/pinecone/router"
|
pineconeRouter "github.com/matrix-org/pinecone/router"
|
||||||
pineconeSessions "github.com/matrix-org/pinecone/sessions"
|
pineconeSessions "github.com/matrix-org/pinecone/sessions"
|
||||||
|
|
@ -41,7 +40,7 @@ func ConnectToPeer(pRouter *pineconeRouter.Router, peer string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RoundTripper struct {
|
type RoundTripper struct {
|
||||||
inner *http2.Transport
|
inner *http.Transport
|
||||||
}
|
}
|
||||||
|
|
||||||
func (y *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
func (y *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
|
@ -55,9 +54,13 @@ func CreateClient(
|
||||||
tr := &http.Transport{}
|
tr := &http.Transport{}
|
||||||
tr.RegisterProtocol(
|
tr.RegisterProtocol(
|
||||||
"matrix", &RoundTripper{
|
"matrix", &RoundTripper{
|
||||||
inner: &http2.Transport{
|
inner: &http.Transport{
|
||||||
AllowHTTP: true,
|
MaxIdleConns: 100,
|
||||||
DialTLS: s.DialTLSForH2C,
|
MaxIdleConnsPerHost: 5,
|
||||||
|
Dial: s.Dial,
|
||||||
|
DialContext: s.DialContext,
|
||||||
|
DialTLS: s.DialTLS,
|
||||||
|
DialTLSContext: s.DialTLSContext,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -72,9 +75,13 @@ func CreateFederationClient(
|
||||||
tr := &http.Transport{}
|
tr := &http.Transport{}
|
||||||
tr.RegisterProtocol(
|
tr.RegisterProtocol(
|
||||||
"matrix", &RoundTripper{
|
"matrix", &RoundTripper{
|
||||||
inner: &http2.Transport{
|
inner: &http.Transport{
|
||||||
AllowHTTP: true,
|
MaxIdleConns: 100,
|
||||||
DialTLS: s.DialTLSForH2C,
|
MaxIdleConnsPerHost: 5,
|
||||||
|
Dial: s.Dial,
|
||||||
|
DialContext: s.DialContext,
|
||||||
|
DialTLS: s.DialTLS,
|
||||||
|
DialTLSContext: s.DialTLSContext,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@ import (
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
"github.com/matrix-org/dendrite/setup/config"
|
||||||
"github.com/matrix-org/dendrite/userapi"
|
"github.com/matrix-org/dendrite/userapi"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"golang.org/x/net/http2"
|
|
||||||
"golang.org/x/net/http2/h2c"
|
|
||||||
|
|
||||||
pineconeMulticast "github.com/matrix-org/pinecone/multicast"
|
pineconeMulticast "github.com/matrix-org/pinecone/multicast"
|
||||||
pineconeRouter "github.com/matrix-org/pinecone/router"
|
pineconeRouter "github.com/matrix-org/pinecone/router"
|
||||||
|
|
@ -224,7 +222,6 @@ func main() {
|
||||||
pQUIC.Mux().Handle(httputil.PublicMediaPathPrefix, pMux)
|
pQUIC.Mux().Handle(httputil.PublicMediaPathPrefix, pMux)
|
||||||
|
|
||||||
// Build both ends of a HTTP multiplex.
|
// Build both ends of a HTTP multiplex.
|
||||||
h2s := &http2.Server{}
|
|
||||||
httpServer := &http.Server{
|
httpServer := &http.Server{
|
||||||
Addr: ":0",
|
Addr: ":0",
|
||||||
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
|
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
|
||||||
|
|
@ -234,7 +231,7 @@ func main() {
|
||||||
BaseContext: func(_ net.Listener) context.Context {
|
BaseContext: func(_ net.Listener) context.Context {
|
||||||
return context.Background()
|
return context.Background()
|
||||||
},
|
},
|
||||||
Handler: h2c.NewHandler(pMux, h2s),
|
Handler: pMux,
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue