Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
httpcaddyfile: Add 'experimental_http3' option
Matthew Holt committed
Sep 11, 2019 at 17:16 UTC
53bbdf17665a34831b32154a2ab7d33ba065743f
2 files changed
+13
caddyconfig/httpcaddyfile/httptype.go
+9
@@ -64,6 +64,8 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
64
val, err = parseHTTPSPort(caddyfile.NewDispenser(segment))
65
case "handler_order":
66
val, err = parseHandlerOrder(caddyfile.NewDispenser(segment))
67
+ case "experimental_http3":
68
+ val, err = parseExperimentalHTTP3(caddyfile.NewDispenser(segment))
69
default:
70
return nil, warnings, fmt.Errorf("unrecognized parameter name: %s", dir)
71
}
@@ -190,6 +192,13 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
192
// consolidate automation policies that are the exact same
193
tlsApp.Automation.Policies = consolidateAutomationPolicies(tlsApp.Automation.Policies)
194
195
+ // if experimental HTTP/3 is enabled, enable it on each server
196
+ if enableH3, ok := options["experimental_http3"].(bool); ok && enableH3 {
197
+ for _, srv := range httpApp.Servers {
198
+ srv.ExperimentalHTTP3 = true
199
+ }
200
+ }
201
+
202
// annnd the top-level config, then we're done!
203
cfg := &caddy.Config{AppsRaw: make(map[string]json.RawMessage)}
204
if !reflect.DeepEqual(httpApp, caddyhttp.App{}) {
caddyconfig/httpcaddyfile/options.go
+4
@@ -52,6 +52,10 @@ func parseHTTPSPort(d *caddyfile.Dispenser) (int, error) {
52
return httpsPort, nil
53
}
54
55
+func parseExperimentalHTTP3(d *caddyfile.Dispenser) (bool, error) {
56
+ return true, nil
57
+}
58
+
59
func parseHandlerOrder(d *caddyfile.Dispenser) ([]string, error) {
60
if !d.Next() {
61
return nil, d.ArgErr()