summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-09-11 17:16:21 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-09-11 17:16:21 -0600
commit53bbdf17665a34831b32154a2ab7d33ba065743f (patch)
treec982c8713bf7dabf08ab429fcfa4dd2d3c3e72f8 /caddyconfig
parente48d83452e42a6eb53f02213dd5981d02627b7b2 (diff)
httpcaddyfile: Add 'experimental_http3' option
Diffstat (limited to 'caddyconfig')
-rw-r--r--caddyconfig/httpcaddyfile/httptype.go9
-rw-r--r--caddyconfig/httpcaddyfile/options.go4
2 files changed, 13 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index 63cbf8d..ce719dd 100644
--- a/caddyconfig/httpcaddyfile/httptype.go
+++ b/caddyconfig/httpcaddyfile/httptype.go
@@ -64,6 +64,8 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
val, err = parseHTTPSPort(caddyfile.NewDispenser(segment))
case "handler_order":
val, err = parseHandlerOrder(caddyfile.NewDispenser(segment))
+ case "experimental_http3":
+ val, err = parseExperimentalHTTP3(caddyfile.NewDispenser(segment))
default:
return nil, warnings, fmt.Errorf("unrecognized parameter name: %s", dir)
}
@@ -190,6 +192,13 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
// consolidate automation policies that are the exact same
tlsApp.Automation.Policies = consolidateAutomationPolicies(tlsApp.Automation.Policies)
+ // if experimental HTTP/3 is enabled, enable it on each server
+ if enableH3, ok := options["experimental_http3"].(bool); ok && enableH3 {
+ for _, srv := range httpApp.Servers {
+ srv.ExperimentalHTTP3 = true
+ }
+ }
+
// annnd the top-level config, then we're done!
cfg := &caddy.Config{AppsRaw: make(map[string]json.RawMessage)}
if !reflect.DeepEqual(httpApp, caddyhttp.App{}) {
diff --git a/caddyconfig/httpcaddyfile/options.go b/caddyconfig/httpcaddyfile/options.go
index d9fb4b0..1d7864c 100644
--- a/caddyconfig/httpcaddyfile/options.go
+++ b/caddyconfig/httpcaddyfile/options.go
@@ -52,6 +52,10 @@ func parseHTTPSPort(d *caddyfile.Dispenser) (int, error) {
return httpsPort, nil
}
+func parseExperimentalHTTP3(d *caddyfile.Dispenser) (bool, error) {
+ return true, nil
+}
+
func parseHandlerOrder(d *caddyfile.Dispenser) ([]string, error) {
if !d.Next() {
return nil, d.ArgErr()