Merge pull request #122176 from slashpai/disable_http2_flag
Expose DisableHTTP2 flag in SecureServingOptions
This commit is contained in:
		@@ -44,6 +44,8 @@ type SecureServingOptions struct {
 | 
				
			|||||||
	// BindNetwork is the type of network to bind to - defaults to "tcp", accepts "tcp",
 | 
						// BindNetwork is the type of network to bind to - defaults to "tcp", accepts "tcp",
 | 
				
			||||||
	// "tcp4", and "tcp6".
 | 
						// "tcp4", and "tcp6".
 | 
				
			||||||
	BindNetwork string
 | 
						BindNetwork string
 | 
				
			||||||
 | 
						// DisableHTTP2Serving indicates that http2 serving should not be enabled.
 | 
				
			||||||
 | 
						DisableHTTP2Serving bool
 | 
				
			||||||
	// Required set to true means that BindPort cannot be zero.
 | 
						// Required set to true means that BindPort cannot be zero.
 | 
				
			||||||
	Required bool
 | 
						Required bool
 | 
				
			||||||
	// ExternalAddress is the address advertised, even if BindAddress is a loopback. By default this
 | 
						// ExternalAddress is the address advertised, even if BindAddress is a loopback. By default this
 | 
				
			||||||
@@ -163,6 +165,9 @@ func (s *SecureServingOptions) AddFlags(fs *pflag.FlagSet) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	fs.IntVar(&s.BindPort, "secure-port", s.BindPort, desc)
 | 
						fs.IntVar(&s.BindPort, "secure-port", s.BindPort, desc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fs.BoolVar(&s.DisableHTTP2Serving, "disable-http2-serving", s.DisableHTTP2Serving,
 | 
				
			||||||
 | 
							"If true, HTTP2 serving will be disabled [default=false]")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fs.StringVar(&s.ServerCert.CertDirectory, "cert-dir", s.ServerCert.CertDirectory, ""+
 | 
						fs.StringVar(&s.ServerCert.CertDirectory, "cert-dir", s.ServerCert.CertDirectory, ""+
 | 
				
			||||||
		"The directory where the TLS certs are located. "+
 | 
							"The directory where the TLS certs are located. "+
 | 
				
			||||||
		"If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.")
 | 
							"If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.")
 | 
				
			||||||
@@ -256,6 +261,7 @@ func (s *SecureServingOptions) ApplyTo(config **server.SecureServingInfo) error
 | 
				
			|||||||
	*config = &server.SecureServingInfo{
 | 
						*config = &server.SecureServingInfo{
 | 
				
			||||||
		Listener:                     s.Listener,
 | 
							Listener:                     s.Listener,
 | 
				
			||||||
		HTTP2MaxStreamsPerConnection: s.HTTP2MaxStreamsPerConnection,
 | 
							HTTP2MaxStreamsPerConnection: s.HTTP2MaxStreamsPerConnection,
 | 
				
			||||||
 | 
							DisableHTTP2:                 s.DisableHTTP2Serving,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	c := *config
 | 
						c := *config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -290,6 +290,7 @@ func TestServerRunWithSNI(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  serverKeyFile,
 | 
											KeyFile:  serverKeyFile,
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
 | 
									DisableHTTP2Serving: true,
 | 
				
			||||||
				SNICertKeys:         namedCertKeys,
 | 
									SNICertKeys:         namedCertKeys,
 | 
				
			||||||
			}).WithLoopback()
 | 
								}).WithLoopback()
 | 
				
			||||||
			// use a random free port
 | 
								// use a random free port
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user