mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	httpcaddyfile: Add 'experimental_http3' option
This commit is contained in:
		
							parent
							
								
									e48d83452e
								
							
						
					
					
						commit
						53bbdf1766
					
				@ -64,6 +64,8 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
 | 
				
			|||||||
				val, err = parseHTTPSPort(caddyfile.NewDispenser(segment))
 | 
									val, err = parseHTTPSPort(caddyfile.NewDispenser(segment))
 | 
				
			||||||
			case "handler_order":
 | 
								case "handler_order":
 | 
				
			||||||
				val, err = parseHandlerOrder(caddyfile.NewDispenser(segment))
 | 
									val, err = parseHandlerOrder(caddyfile.NewDispenser(segment))
 | 
				
			||||||
 | 
								case "experimental_http3":
 | 
				
			||||||
 | 
									val, err = parseExperimentalHTTP3(caddyfile.NewDispenser(segment))
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
				return nil, warnings, fmt.Errorf("unrecognized parameter name: %s", dir)
 | 
									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
 | 
						// consolidate automation policies that are the exact same
 | 
				
			||||||
	tlsApp.Automation.Policies = consolidateAutomationPolicies(tlsApp.Automation.Policies)
 | 
						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!
 | 
						// annnd the top-level config, then we're done!
 | 
				
			||||||
	cfg := &caddy.Config{AppsRaw: make(map[string]json.RawMessage)}
 | 
						cfg := &caddy.Config{AppsRaw: make(map[string]json.RawMessage)}
 | 
				
			||||||
	if !reflect.DeepEqual(httpApp, caddyhttp.App{}) {
 | 
						if !reflect.DeepEqual(httpApp, caddyhttp.App{}) {
 | 
				
			||||||
 | 
				
			|||||||
@ -52,6 +52,10 @@ func parseHTTPSPort(d *caddyfile.Dispenser) (int, error) {
 | 
				
			|||||||
	return httpsPort, nil
 | 
						return httpsPort, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func parseExperimentalHTTP3(d *caddyfile.Dispenser) (bool, error) {
 | 
				
			||||||
 | 
						return true, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func parseHandlerOrder(d *caddyfile.Dispenser) ([]string, error) {
 | 
					func parseHandlerOrder(d *caddyfile.Dispenser) ([]string, error) {
 | 
				
			||||||
	if !d.Next() {
 | 
						if !d.Next() {
 | 
				
			||||||
		return nil, d.ArgErr()
 | 
							return nil, d.ArgErr()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user