From acd51bbc90dad86c593aba1ce84fc578f36702d6 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Wed, 1 Jul 2020 00:01:36 +0800 Subject: [PATCH] Fix: obfs host should not have 80 port --- component/simple-obfs/http.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/component/simple-obfs/http.go b/component/simple-obfs/http.go index ab1b59b7..11894357 100644 --- a/component/simple-obfs/http.go +++ b/component/simple-obfs/http.go @@ -67,7 +67,10 @@ func (ho *HTTPObfs) Write(b []byte) (int, error) { req.Header.Set("User-Agent", fmt.Sprintf("curl/7.%d.%d", rand.Int()%54, rand.Int()%2)) req.Header.Set("Upgrade", "websocket") req.Header.Set("Connection", "Upgrade") - req.Host = fmt.Sprintf("%s:%s", ho.host, ho.port) + req.Host = ho.host + if ho.port != "80" { + req.Host = fmt.Sprintf("%s:%s", ho.host, ho.port) + } req.Header.Set("Sec-WebSocket-Key", base64.URLEncoding.EncodeToString(randBytes)) req.ContentLength = int64(len(b)) err := req.Write(ho.Conn)