Fix: obfs host should not have 80 port
This commit is contained in:
parent
f44cd9180c
commit
acd51bbc90
1 changed files with 4 additions and 1 deletions
|
@ -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("User-Agent", fmt.Sprintf("curl/7.%d.%d", rand.Int()%54, rand.Int()%2))
|
||||||
req.Header.Set("Upgrade", "websocket")
|
req.Header.Set("Upgrade", "websocket")
|
||||||
req.Header.Set("Connection", "Upgrade")
|
req.Header.Set("Connection", "Upgrade")
|
||||||
|
req.Host = ho.host
|
||||||
|
if ho.port != "80" {
|
||||||
req.Host = fmt.Sprintf("%s:%s", ho.host, ho.port)
|
req.Host = fmt.Sprintf("%s:%s", ho.host, ho.port)
|
||||||
|
}
|
||||||
req.Header.Set("Sec-WebSocket-Key", base64.URLEncoding.EncodeToString(randBytes))
|
req.Header.Set("Sec-WebSocket-Key", base64.URLEncoding.EncodeToString(randBytes))
|
||||||
req.ContentLength = int64(len(b))
|
req.ContentLength = int64(len(b))
|
||||||
err := req.Write(ho.Conn)
|
err := req.Write(ho.Conn)
|
||||||
|
|
Loading…
Reference in a new issue