From bad4b140a08fff56cc22c9d1e862e1c69aefb049 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Sun, 28 Feb 2021 21:34:29 +0100 Subject: [PATCH] Respect -dns flag when -https is enabled This change makes the `-dns` flag be respected with the `-https` flag Before this change the `sudo hyperfox -ui -http 80 -dns 8.8.8.8` -> `curl http://example.com` lead to an infinite request loop when `-https` was also supplied (i.e. `sudo hyperfox -ui -http 80 -https 443 -dns 8.8.8.8`). --- pkg/proxy/proxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/proxy/proxy.go b/pkg/proxy/proxy.go index c6c6b29..f39654a 100644 --- a/pkg/proxy/proxy.go +++ b/pkg/proxy/proxy.go @@ -412,7 +412,9 @@ func (p *Proxy) StartTLS(addr string) error { p.srv = srv p.ln = ln - p.rt = &http.Transport{} + p.rt = &http.Transport{ + DialContext: p.dialContext, + } log.Printf("Listening for HTTP requests at %s (SSL/TLS mode)\n", addr) if err := p.srv.Serve(tlsListener); err != nil {