summaryrefslogtreecommitdiff
path: root/service/http/service.go
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-06-14 23:43:00 +0300
committerGitHub <[email protected]>2019-06-14 23:43:00 +0300
commit85126b000d140efdd99573e44241ee1e8b84d3c5 (patch)
treecf60b725f10f87ebb1e575788d82d662dcd36752 /service/http/service.go
parent78724c084ac4db42e713c45ef8cb1453e8352183 (diff)
parent4f908e07c5675f221c5b71380bf96fa8ad8d01a9 (diff)
Merge pull request #163 from ovr/http2-improve
Service(http): Support configuration for HTTP2 (and disabling)
Diffstat (limited to 'service/http/service.go')
-rw-r--r--service/http/service.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/service/http/service.go b/service/http/service.go
index b309cd45..00d877ec 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -104,6 +104,12 @@ func (s *Service) Serve() error {
if s.cfg.EnableTLS() {
s.https = s.initSSL()
+
+ if s.cfg.EnableHTTP2() {
+ if err := s.InitHTTP2(); err != nil {
+ return err
+ }
+ }
}
if s.cfg.EnableFCGI() {
@@ -209,12 +215,15 @@ func (s *Service) initSSL() *http.Server {
server := &http.Server{Addr: s.tlsAddr(s.cfg.Address, true), Handler: s}
s.throw(EventInitSSL, server)
- // Enable HTTP/2 support by default
- http2.ConfigureServer(server, &http2.Server{})
-
return server
}
+func (s *Service) InitHTTP2() error {
+ return http2.ConfigureServer(s.https, &http2.Server{
+ MaxConcurrentStreams: s.cfg.HTTP2.MaxConcurrentStreams,
+ })
+}
+
// throw handles service, server and pool events.
func (s *Service) throw(event int, ctx interface{}) {
for _, l := range s.lsns {