Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 347aa0e

Browse files
committed
[proxy]https host识别中增加端口
1 parent 14c5fbd commit 347aa0e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

teaproxy/listener.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"golang.org/x/net/http2"
1212
"net"
1313
"net/http"
14+
"strings"
1415
"sync"
1516
"sync/atomic"
1617
"time"
@@ -409,7 +410,13 @@ func (this *Listener) handleHTTP(writer http.ResponseWriter, rawRequest *http.Re
409410
if rawRequest.TLS != nil {
410411
serverName := rawRequest.TLS.ServerName
411412
if len(serverName) > 0 {
412-
reqHost = serverName
413+
// 端口
414+
index := strings.LastIndex(reqHost, ":")
415+
if index >= 0 {
416+
reqHost = serverName + reqHost[index:]
417+
} else {
418+
reqHost = serverName
419+
}
413420
}
414421
}
415422

0 commit comments

Comments
 (0)