Willy
(Willy)
February 3, 2023, 8:40am
1
By using this code:
log.Fatal(http.ListenAndServeTLS(
":80",
pathToCerFile,
pathToKeyFile,
http.HandlerFunc(someRouter),
))
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?
freeformz
(Edward Muller)
February 4, 2023, 8:05pm
2
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
system
(system)
Closed
May 5, 2023, 8:05pm
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.