When I use http.ListenAndServeTLS what are the default values?

By using this code:


What values would these options have for example ReadTimeout, WriteTimeout, MaxHeaderBytes?

If I want to have custom values for those options am I obliged to use the &http.Server{} struct?

Here is the implementation of http.ListenAndServeTLS:

func ListenAndServeTLS(addr, certFile, keyFile string, handler Handler) error {
	server := &Server{Addr: addr, Handler: handler}
	return server.ListenAndServeTLS(certFile, keyFile)

So it creates a pretty basic http.Server and uses that. The Server documentation indicates that by default there aren’t any timeouts. So you would have to construct a server yourself and call it’s ListenAndServeTLS method.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.