Skip to content

Commit c36898f

Browse files
committed
refactor: fix slowloris linter error
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent 736b538 commit c36898f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

example/example.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"fmt"
55
"net/http"
6+
"time"
67

78
echo "github.com/aperturerobotics/starpc/echo"
89
"github.com/aperturerobotics/starpc/srpc"
@@ -24,7 +25,8 @@ func main() {
2425
}
2526

2627
fmt.Print("listening on :5050\n")
27-
if err := http.ListenAndServe(":5050", server); err != nil {
28+
srv := &http.Server{Addr: ":5050", Handler: server, ReadHeaderTimeout: time.Second * 5}
29+
if err := srv.ListenAndServe(); err != nil {
2830
logrus.Fatal(err.Error())
2931
}
3032
}

0 commit comments

Comments
 (0)