1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-11-10 04:41:38 +01:00

Don't redirect by default

This commit is contained in:
adnano 2020-11-05 15:44:01 -05:00
parent ad403ddecf
commit ad5aa57219

@ -40,8 +40,7 @@ type Client struct {
GetInput func(prompt string, sensitive bool) (input string, ok bool)
// CheckRedirect determines whether to follow a redirect.
// If CheckRedirect is nil, a default policy of no more than 5 consecutive
// redirects will be enforced.
// If CheckRedirect is nil, redirects will not be followed.
CheckRedirect func(req *Request, via []*Request) error
// CreateCertificate is called to generate a certificate upon
@ -163,11 +162,8 @@ func (c *Client) do(req *Request, via []*Request) (*Response, error) {
if err := c.CheckRedirect(redirect, via); err != nil {
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