diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-04-09 20:18:54 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-04-09 20:18:54 -0700 |
commit | 7640a8cbab897b6791e885534ec9650dee669ce2 (patch) | |
tree | d67a2bee699599c4bed146e30189f9c4b635e35a /http | |
parent | 3d59cdba103f99e93612c9b9a91cc63361f1d8d0 (diff) |
Ignore caching headers for feeds that send "Expires: 0"
Diffstat (limited to 'http')
-rw-r--r-- | http/client.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/http/client.go b/http/client.go index 9bcd14e..1884224 100644 --- a/http/client.go +++ b/http/client.go @@ -129,17 +129,25 @@ func (c *Client) executeRequest(request *http.Request) (*Response, error) { ContentLength: resp.ContentLength, } - logger.Debug("[HttpClient:%s] OriginalURL=%s, StatusCode=%d, ContentLength=%d, ContentType=%s, ETag=%s, LastModified=%s, EffectiveURL=%s", + logger.Debug("[HttpClient:%s] URL=%s, EffectiveURL=%s, Code=%d, Length=%d, Type=%s, ETag=%s, LastMod=%s, Expires=%s", request.Method, c.url, + response.EffectiveURL, response.StatusCode, resp.ContentLength, response.ContentType, response.ETag, response.LastModified, - response.EffectiveURL, + resp.Header.Get("Expires"), ) + // Ignore caching headers for feeds that do not want any cache. + if resp.Header.Get("Expires") == "0" { + logger.Debug("[HttpClient] Ignore caching headers for %q", response.EffectiveURL) + response.ETag = "" + response.LastModified = "" + } + return response, err } |