Don't redirect by default
This commit is contained in:
parent
bf185e4091
commit
520d0a7fb1
|
@ -40,8 +40,7 @@ type Client struct {
|
||||||
GetInput func(prompt string, sensitive bool) (input string, ok bool)
|
GetInput func(prompt string, sensitive bool) (input string, ok bool)
|
||||||
|
|
||||||
// CheckRedirect determines whether to follow a redirect.
|
// CheckRedirect determines whether to follow a redirect.
|
||||||
// If CheckRedirect is nil, a default policy of no more than 5 consecutive
|
// If CheckRedirect is nil, redirects will not be followed.
|
||||||
// redirects will be enforced.
|
|
||||||
CheckRedirect func(req *Request, via []*Request) error
|
CheckRedirect func(req *Request, via []*Request) error
|
||||||
|
|
||||||
// CreateCertificate is called to generate a certificate upon
|
// CreateCertificate is called to generate a certificate upon
|
||||||
|
@ -163,12 +162,9 @@ func (c *Client) do(req *Request, via []*Request) (*Response, error) {
|
||||||
if err := c.CheckRedirect(redirect, via); err != nil {
|
if err := c.CheckRedirect(redirect, via); err != nil {
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
} else if len(via) > 5 {
|
|
||||||
// Default policy of no more than 5 redirects
|
|
||||||
return resp, errors.New("gemini: too many redirects")
|
|
||||||
}
|
|
||||||
return c.do(redirect, via)
|
return c.do(redirect, via)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resp.Request = req
|
resp.Request = req
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user