Fix: obfs host should not have 80 port

This commit is contained in:
Dreamacro 2020-07-01 00:01:36 +08:00
parent f44cd9180c
commit acd51bbc90

View file

@ -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)