summaryrefslogtreecommitdiff
path: root/service/http/config.go
diff options
context:
space:
mode:
authorDmitry Patsura <[email protected]>2019-06-14 16:45:52 +0300
committerDmitry Patsura <[email protected]>2019-06-14 16:46:11 +0300
commit15746d3706fb9ed1e4a8e7d925f033878744b6a1 (patch)
treef775f49826c327234a176d0c35fa95fbe4bc99db /service/http/config.go
parent928bff44e21997e4b5f1caefa0e8a627a235b01d (diff)
Feature(http): Ability to disable HTTP2
Diffstat (limited to 'service/http/config.go')
-rw-r--r--service/http/config.go28
1 files changed, 20 insertions, 8 deletions
diff --git a/service/http/config.go b/service/http/config.go
index caf94d98..b4575914 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -18,8 +18,6 @@ type Config struct {
// SSL defines https server options.
SSL SSLConfig
- HTTP2 *HTTP2Config
-
FCGI FCGIConfig
// MaxRequestSize specified max size for payload body in megabytes, set 0 to unlimited.
@@ -32,6 +30,9 @@ type Config struct {
// Uploads configures uploads configuration.
Uploads *UploadsConfig
+ // HTTP2 configuration
+ HTTP2 *HTTP2Config
+
// Workers configures rr server and worker pool.
Workers *roadrunner.ServerConfig
}
@@ -42,9 +43,17 @@ type FCGIConfig struct {
}
type HTTP2Config struct {
+ Enabled bool
MaxConcurrentStreams uint32
}
+func (cfg *HTTP2Config) InitDefaults() error {
+ cfg.Enabled = true
+ cfg.MaxConcurrentStreams = 128
+
+ return nil
+}
+
// SSLConfig defines https server configuration.
type SSLConfig struct {
// Port to listen as HTTPS server, defaults to 443.
@@ -79,6 +88,10 @@ func (c *Config) Hydrate(cfg service.Config) error {
c.Workers = &roadrunner.ServerConfig{}
}
+ if c.HTTP2 == nil {
+ c.HTTP2 = &HTTP2Config{}
+ }
+
if c.Uploads == nil {
c.Uploads = &UploadsConfig{}
}
@@ -87,12 +100,7 @@ func (c *Config) Hydrate(cfg service.Config) error {
c.SSL.Port = 443
}
- if c.HTTP2 == nil {
- c.HTTP2 = &HTTP2Config{
- MaxConcurrentStreams: 128,
- }
- }
-
+ c.HTTP2.InitDefaults()
c.Uploads.InitDefaults()
c.Workers.InitDefaults()
@@ -161,6 +169,10 @@ func (c *Config) Valid() error {
return errors.New("mailformed uploads config")
}
+ if c.HTTP2 == nil {
+ return errors.New("mailformed http2 config")
+ }
+
if c.Workers == nil {
return errors.New("mailformed workers config")
}