Open fmsmartcommerce opened 4 years ago
That doc is already outdated. Kingfisher was designed at the beginning with its own cache system, instead of using a 304 status code to determine the cache policy. I am afraid it is intended not supported in the current versions of Kingfisher anymore. (That is also the reason the doc was removed from the wiki of this repo.)
If you have control of your server and can determine the image URL, I suggest you choose a simpler way, like appending a timestamp or version to the image (such as https://example.com?version=123
) and let the client use the versioning URL to fetch an image.
I will try to investigate the possibility of supporting 304 again in a better way internally. However, there is no time schedule for it now. :[
Thanks for clarifying! I was able to workaround it for now (as you can see in my gist). Unfortunately I don't have control of the server, so if the deprecated function I had to use for the workaround is gone in some future version, I'll probably have to switch to downloading ETag images without Kingfisher (and keep using Kingfisher for all other images - great work!).
That doc is already outdated. Kingfisher was designed at the beginning with its own cache system, instead of using a 304 status code to determine the cache policy. I am afraid it is intended not supported in the current versions of Kingfisher anymore. (That is also the reason the doc was removed from the wiki of this repo.)
If you have control of your server and can determine the image URL, I suggest you choose a simpler way, like appending a timestamp or version to the image (such as
https://example.com?version=123
) and let the client use the versioning URL to fetch an image.I will try to investigate the possibility of supporting 304 again in a better way internally. However, there is no time schedule for it now. :[
i am too facing same issue. Please try supporting this issue as early as possible. @onevcat
Check List
Issue Description
What
I tried to build a download/cache mechanism respecting ETags based on this outdated guide: https://github.com/qingkong1998/qingkong/wiki/How-to-implement-ETag-based-304-(Not-Modified)-handling-in-Kingfisher
I think I kinda got it right - If-None-Match header is added and the server returns 304. Unfortunately I don't see any images in my image view.
From what I can see in the code the statusCode never seems to be explicitly checked for "Not Modified", so the DownloadTask just returns the body data - which is empty in case of a 304 response.
The guide reads like earlier versions of Kingfisher respected 304 and fetched the image from cache. Is there any chance of this behavior returning to Kingfisher?
Reproduce
Find a gist of my EtagImageDownloader here: https://gist.github.com/fmsmartcommerce/0d5e0b6dafd14dbac24bb06e3a30ed6b