mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-22 11:23:32 +02:00
HTTP transport: Use dest as Host if not set (#4038)
This commit is contained in:
parent
6ba0dbafd7
commit
0a252ac15d
2 changed files with 9 additions and 2 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func (c *Config) getHosts() []string {
|
||||
if len(c.Host) == 0 {
|
||||
return []string{"www.example.com"}
|
||||
return []string{""}
|
||||
}
|
||||
return c.Host
|
||||
}
|
||||
|
|
|
@ -215,9 +215,16 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
}
|
||||
}
|
||||
|
||||
Host := httpSettings.getRandomHost()
|
||||
if Host == "" && net.ParseAddress(dest.NetAddr()).Family().IsDomain() {
|
||||
Host = dest.Address.String()
|
||||
} else if Host == "" {
|
||||
Host = "www.example.com"
|
||||
}
|
||||
|
||||
request := &http.Request{
|
||||
Method: httpMethod,
|
||||
Host: httpSettings.getRandomHost(),
|
||||
Host: Host,
|
||||
Body: breader,
|
||||
URL: &url.URL{
|
||||
Scheme: "https",
|
||||
|
|
Loading…
Reference in a new issue