use official h2c server
This commit is contained in:
parent
b1a31134bd
commit
7888d3e13d
@ -13,11 +13,11 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/micro/h2c"
|
|
||||||
maddr "github.com/micro/util/go/lib/addr"
|
maddr "github.com/micro/util/go/lib/addr"
|
||||||
mnet "github.com/micro/util/go/lib/net"
|
mnet "github.com/micro/util/go/lib/net"
|
||||||
mls "github.com/micro/util/go/lib/tls"
|
mls "github.com/micro/util/go/lib/tls"
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
|
"golang.org/x/net/http2/h2c"
|
||||||
)
|
)
|
||||||
|
|
||||||
type buffer struct {
|
type buffer struct {
|
||||||
@ -424,10 +424,7 @@ func (h *httpTransportListener) Accept(fn func(Socket)) error {
|
|||||||
|
|
||||||
// insecure connection use h2c
|
// insecure connection use h2c
|
||||||
if !(h.ht.opts.Secure || h.ht.opts.TLSConfig != nil) {
|
if !(h.ht.opts.Secure || h.ht.opts.TLSConfig != nil) {
|
||||||
srv.Handler = &h2c.HandlerH2C{
|
srv.Handler = h2c.NewHandler(mux, &http2.Server{})
|
||||||
Handler: mux,
|
|
||||||
H2Server: &http2.Server{},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin serving
|
// begin serving
|
||||||
|
Loading…
Reference in New Issue
Block a user