mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
fix; handling http.proxy stop gracefully
This commit is contained in:
parent
d87bf8a3ba
commit
7b42da1bf3
1 changed files with 5 additions and 1 deletions
|
@ -1,9 +1,11 @@
|
|||
package modules
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/elazarl/goproxy"
|
||||
|
||||
|
@ -191,7 +193,9 @@ func (p *HttpProxy) Start() error {
|
|||
func (p *HttpProxy) Stop() error {
|
||||
if p.Running() == true {
|
||||
p.SetRunning(false)
|
||||
p.server.Shutdown(nil)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
p.server.Shutdown(ctx)
|
||||
if p.redirection != nil {
|
||||
log.Debug("Disabling redirection %s", p.redirection.String())
|
||||
if err := p.Session.Firewall.EnableRedirection(p.redirection, false); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue