summaryrefslogtreecommitdiff
path: root/service/http/service.go
diff options
context:
space:
mode:
authorAlex Bond <[email protected]>2019-07-26 23:13:58 -0700
committerAlex Bond <[email protected]>2019-07-26 23:13:58 -0700
commit773157f108b17130ea4877796b808ca23d263001 (patch)
treefbf380492823e936ac70618fafc0e82c857a2e0f /service/http/service.go
parentc26573fe10b827c55b84ac615be69c166e5fa3e9 (diff)
Attempt to add h2c handling (http2 w/o ssl)
Diffstat (limited to 'service/http/service.go')
-rw-r--r--service/http/service.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/service/http/service.go b/service/http/service.go
index d764e71c..845c4f1f 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -9,6 +9,7 @@ import (
"github.com/spiral/roadrunner/service/rpc"
"github.com/spiral/roadrunner/util"
"golang.org/x/net/http2"
+ "golang.org/x/net/http2/h2c"
"net/http"
"net/http/fcgi"
"net/url"
@@ -99,7 +100,13 @@ func (s *Service) Serve() error {
s.handler.Listen(s.throw)
if s.cfg.EnableHTTP() {
- s.http = &http.Server{Addr: s.cfg.Address, Handler: s}
+ var h2s *http2.Server
+ if s.cfg.EnableHTTP2() && !s.cfg.EnableTLS() {
+ h2s = &http2.Server{}
+ s.http = &http.Server{Addr: s.cfg.Address, Handler: h2c.NewHandler(s, h2s)}
+ } else {
+ s.http = &http.Server{Addr: s.cfg.Address, Handler: s}
+ }
}
if s.cfg.EnableTLS() {