Browse Source

Fix conditional requests regression

The recent HTTP client refactor in 14e25ab9fe09b9951b38e56af2bdff7a0737b280
caused feed refreshes to no longer make conditional requests. Prior to
the refactor, `client.WithCacheHeaders` handled this. Now this function
is split into `fetcher.WithETag` and `fetcher.WithLastModified` but
these functions are only declared and never actually used. Fix this by
calling them inside `handler.RefreshFeed`.
Thomas J Faughnan Jr 2 years ago
parent
commit
fe0ef8b579
1 changed files with 2 additions and 0 deletions
  1. 2 0
      internal/reader/handler/handler.go

+ 2 - 0
internal/reader/handler/handler.go

@@ -232,6 +232,8 @@ func RefreshFeed(store *storage.Storage, userID, feedID int64, forceRefresh bool
 	requestBuilder.WithUsernameAndPassword(originalFeed.Username, originalFeed.Password)
 	requestBuilder.WithUserAgent(originalFeed.UserAgent, config.Opts.HTTPClientUserAgent())
 	requestBuilder.WithCookie(originalFeed.Cookie)
+	requestBuilder.WithETag(originalFeed.EtagHeader)
+	requestBuilder.WithLastModified(originalFeed.LastModifiedHeader)
 	requestBuilder.WithTimeout(config.Opts.HTTPClientTimeout())
 	requestBuilder.WithProxy(config.Opts.HTTPClientProxy())
 	requestBuilder.UseProxy(originalFeed.FetchViaProxy)