зеркало из https://github.com/microsoft/LaBench.git
code review comments
This commit is contained in:
Родитель
6934f235c7
Коммит
3a62319a69
|
@ -162,17 +162,17 @@ func (w *webRequester) Request() error {
|
||||||
|
|
||||||
var hosts []string
|
var hosts []string
|
||||||
|
|
||||||
// headers are case-insensitive
|
//case insensitive
|
||||||
for k, v := range w.headers {
|
if host, ok := w.headers["host"]; ok {
|
||||||
if strings.ToLower(k) == "host" {
|
if len(hosts) != 1 {
|
||||||
hosts = append(hosts, v...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(hosts) > 1 {
|
|
||||||
return errors.New("multiple host headers are not allowed")
|
return errors.New("multiple host headers are not allowed")
|
||||||
}
|
}
|
||||||
if len(hosts) > 0 {
|
req.Host = host[0]
|
||||||
req.Host = hosts[0]
|
} else if host, ok = w.headers["Host"]; ok {
|
||||||
|
if len(hosts) != 1 {
|
||||||
|
return errors.New("multiple host headers are not allowed")
|
||||||
|
}
|
||||||
|
req.Host = host[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := httpClient.Do(req)
|
resp, err := httpClient.Do(req)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче