Ignore caching headers for feeds that send "Expires: 0"
This commit is contained in:
parent
3d59cdba10
commit
7640a8cbab
1 changed files with 10 additions and 2 deletions
|
@ -129,17 +129,25 @@ func (c *Client) executeRequest(request *http.Request) (*Response, error) {
|
||||||
ContentLength: resp.ContentLength,
|
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,
|
request.Method,
|
||||||
c.url,
|
c.url,
|
||||||
|
response.EffectiveURL,
|
||||||
response.StatusCode,
|
response.StatusCode,
|
||||||
resp.ContentLength,
|
resp.ContentLength,
|
||||||
response.ContentType,
|
response.ContentType,
|
||||||
response.ETag,
|
response.ETag,
|
||||||
response.LastModified,
|
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
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue