misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-09-24 13:42:25 +02:00
commit 7234323840
No known key found for this signature in database
GPG key ID: 82E42E7F3B34C97E

View file

@ -277,7 +277,7 @@ func (p *HTTPProxy) httpsWorker() error {
for p.isRunning { for p.isRunning {
c, err := p.sniListener.Accept() c, err := p.sniListener.Accept()
if err != nil { if err != nil {
log.Warning("Error accepting connection: %s.", err) log.Warning("error accepting connection: %s.", err)
continue continue
} }
@ -288,17 +288,17 @@ func (p *HTTPProxy) httpsWorker() error {
tlsConn, err := vhost.TLS(c) tlsConn, err := vhost.TLS(c)
if err != nil { if err != nil {
log.Warning("Error reading SNI: %s.", err) log.Warning("error reading SNI: %s.", err)
return return
} }
hostname := tlsConn.Host() hostname := tlsConn.Host()
if hostname == "" { if hostname == "" {
log.Warning("Client does not support SNI.") log.Warning("client does not support SNI.")
return return
} }
log.Debug("Got new SNI from %s for %s", core.Bold(stripPort(c.RemoteAddr().String())), core.Yellow(hostname)) log.Debug("[%s] proxying connection from %s to %s", core.Green("https.proxy"), core.Bold(stripPort(c.RemoteAddr().String())), core.Yellow(hostname))
req := &http.Request{ req := &http.Request{
Method: "CONNECT", Method: "CONNECT",