diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-06-19 22:58:29 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-06-19 22:58:29 -0700 |
commit | bddca15b69692bd055c507f2469e68dca1e56098 (patch) | |
tree | 913989e170cc3ac46558c682f8ec10813a0ae3c5 /http | |
parent | 261695c14c2d768f392cfb774e7940660edaa3d9 (diff) |
Add new fields for feed username/password
Diffstat (limited to 'http')
-rw-r--r-- | http/client/client.go | 9 |
1 files changed, 6 insertions, 3 deletions
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. |