MCPcopy Create free account
hub / github.com/BryanMwangi/pine / Start

Method Start

pine.go:337–355  ·  view source on GitHub ↗

Start listens on address and serves requests.

(address string)

Source from the content-addressed store, hash-verified

335
336// Start listens on address and serves requests.
337func (server *Server) Start(address string) error {
338 httpServer := &http.Server{
339 Addr: address,
340 ReadTimeout: server.config.ReadTimeout,
341 WriteTimeout: server.config.WriteTimeout,
342 Handler: server,
343 }
344
345 server.server = httpServer
346 server.server.SetKeepAlivesEnabled(!server.config.DisableKeepAlive)
347
348 if server.config.TLSConfig.ServeTLS {
349 if server.config.TLSConfig.CertFile == "" || server.config.TLSConfig.KeyFile == "" {
350 panic("certfile and keyfile are required to serve https")
351 }
352 return httpServer.ListenAndServeTLS(server.config.TLSConfig.CertFile, server.config.TLSConfig.KeyFile)
353 }
354 return httpServer.ListenAndServe()
355}
356
357func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
358 wrappedWriter := &responseWriterWrapper{ResponseWriter: w}

Callers 15

TestStart_HTTPServerFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestStart_HTTPServerFunction · 0.36