Procházet zdrojové kódy

http service timeout

ls před 4 roky
rodič
revize
f8908e8e08
1 změnil soubory, kde provedl 11 přidání a 7 odebrání
  1. 11 7
      serve.go

+ 11 - 7
serve.go

@@ -12,17 +12,21 @@ import (
 )
 
 var (
-	readTimeout  = 30 * time.Second
-	writeTimeout = 30 * time.Second
+	readTimeout       = 30 * time.Second
+	readHeaderTimeout = 30 * time.Second
+	writeTimeout      = 30 * time.Second
+	idleTimeout       = 30 * time.Second
 )
 
 func newServe(addr string, router http.Handler) *http.Server {
 	return &http.Server{
-		Addr:           addr,
-		Handler:        router,
-		ReadTimeout:    readTimeout,
-		WriteTimeout:   writeTimeout,
-		MaxHeaderBytes: MB,
+		Addr:              addr,
+		Handler:           router,
+		ReadTimeout:       readTimeout,
+		ReadHeaderTimeout: readHeaderTimeout,
+		WriteTimeout:      writeTimeout,
+		IdleTimeout:       idleTimeout,
+		MaxHeaderBytes:    MB,
 	}
 }