summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-07-29 15:32:19 +0300
committerGitHub <[email protected]>2019-07-29 15:32:19 +0300
commit2879c62c3cbdcde328ecc9bacee1d6d8fbdec44a (patch)
treefbf380492823e936ac70618fafc0e82c857a2e0f
parentc26573fe10b827c55b84ac615be69c166e5fa3e9 (diff)
parent773157f108b17130ea4877796b808ca23d263001 (diff)
Merge pull request #173 from Alex-Bond/feature/h2c
Attempt to add h2c handling (http2 w/o ssl)
-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() {