mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
lib/promscrape: handle connection reset when targets responds with http redirect
This commit is contained in:
parent
3e6f29f462
commit
53740d0026
1 changed files with 0 additions and 9 deletions
|
@ -133,15 +133,6 @@ var (
|
|||
func doRequestWithPossibleRetry(hc *fasthttp.HostClient, req *fasthttp.Request, resp *fasthttp.Response) error {
|
||||
// There is no need in calling DoTimeout, since the timeout must be already set in hc.ReadTimeout.
|
||||
err := hc.Do(req, resp)
|
||||
if err == nil && (resp.Header.StatusCode() == 301 || resp.Header.StatusCode() == 302) {
|
||||
l := string(resp.Header.Peek("Location"))
|
||||
if l != "" {
|
||||
req.URI().Update(l)
|
||||
// only redirect once
|
||||
err = hc.Do(req, resp)
|
||||
}
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue