Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Feb 5, 2024
1 parent fd3e671 commit b88f0d9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/http"
"os"
"os/exec"
"regexp"
)

func GetFreePort() (port int, err error) {
Expand All @@ -23,6 +24,7 @@ func GetFreePort() (port int, err error) {
}

var outPort int
var reg *regexp.Regexp = regexp.MustCompile("[^a-zA-Z0-9-]+")

func init() {
var err error
Expand Down Expand Up @@ -119,9 +121,10 @@ func handleConnection(clientConn net.Conn) {

func filterInvalidHeaders(headers http.Header) {
// Define invalid headers
invalidHeaders := []string{"!~passenger-Proto", "!~passenger-Client-Address", "!~passenger-Envvars"}

for _, header := range invalidHeaders {
delete(headers, header)
for header := range headers {
if reg.FindString(header) != "" {
delete(headers, header)
}
}
}

0 comments on commit b88f0d9

Please sign in to comment.