Skip to content

Commit

Permalink
Adding ReadHeaderTimeout to prevent Slowloris DoS (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfish7 authored May 22, 2023
1 parent 54fcb22 commit 3e6d531
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions relay/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net"
"net/http"
"time"

"github.com/fullstorydev/relay-core/relay/traffic"
)
Expand Down Expand Up @@ -75,8 +76,9 @@ func (service *Service) Port() int {
func (service *Service) Start(host string, port int) error {
address := fmt.Sprintf("%v:%v", host, port)
server := &http.Server{
Addr: address,
Handler: service.mux,
Addr: address,
Handler: service.mux,
ReadHeaderTimeout: 2 * time.Second,
}
listener, err := net.Listen("tcp", address)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion relay/version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

const RelayRelease = "v0.3.0" // TODO set this from tags automatically during git commit
const RelayRelease = "v0.3.1" // TODO set this from tags automatically during git commit

0 comments on commit 3e6d531

Please sign in to comment.