From bddca15b69692bd055c507f2469e68dca1e56098 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 19 Jun 2018 22:58:29 -0700 Subject: Add new fields for feed username/password --- http/client/client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'http') diff --git a/http/client/client.go b/http/client/client.go index 60ebbc7..d808a70 100644 --- a/http/client/client.go +++ b/http/client/client.go @@ -52,8 +52,10 @@ type Client struct { // WithCredentials defines the username/password for HTTP Basic authentication. func (c *Client) WithCredentials(username, password string) *Client { - c.username = username - c.password = password + if username != "" && password != "" { + c.username = username + c.password = password + } return c } @@ -159,7 +161,7 @@ func (c *Client) executeRequest(request *http.Request) (*Response, error) { ContentLength: resp.ContentLength, } - logger.Debug("[HttpClient:%s] URL=%s, EffectiveURL=%s, Code=%d, Length=%d, Type=%s, ETag=%s, LastMod=%s, Expires=%s", + logger.Debug("[HttpClient:%s] URL=%s, EffectiveURL=%s, Code=%d, Length=%d, Type=%s, ETag=%s, LastMod=%s, Expires=%s, Auth=%v", request.Method, c.url, response.EffectiveURL, @@ -169,6 +171,7 @@ func (c *Client) executeRequest(request *http.Request) (*Response, error) { response.ETag, response.LastModified, resp.Header.Get("Expires"), + c.username != "", ) // Ignore caching headers for feeds that do not want any cache. -- cgit v1.2.3