Skip to content

Commit

Permalink
Merge pull request #15 from mysteriumnetwork/fix/panic-on-malformed-t…
Browse files Browse the repository at this point in the history
…ls-request

Do not panic for malformed TLS request
  • Loading branch information
soffokl authored Feb 21, 2020
2 parents ea22ec3 + ae83cd3 commit ea4dc4b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ func (s *proxyServer) authorityAddr(scheme, authority string) string {
}

func (s *proxyServer) serveTLS(c net.Conn) {
defer func() {
// For some malformed TLS connection vhost.TLS could panic.
// We don't care about a single failed request, service should keep working.
if r := recover(); r != nil {
log.Println("Recovered panic in serveTLS", r)
}
}()

tlsConn, err := vhost.TLS(c)
if err != nil {
log.Printf("Error accepting new connection - %v", err)
Expand Down

0 comments on commit ea4dc4b

Please sign in to comment.