[xep-support] Re: How often does XEP.BAT use my graphic-URL?

From: Alexey Medvedev <amedvedev_at_ADDRESS_REMOVED>
Date: Mon Aug 10 2020 - 07:14:50 PDT

Hello Fritz,

> I cannot see any “Expires:“ header
>
That's precisely the reason why XEP makes multiple requests.

I've set up simple file sharing via "python -m http.server" and
inspected XEP's behavior with your fo but referring an image shared via
python.

XEP successfully cashes the image in memory while accessing it for the
first time, but as there is no /"Expires"/ header expiration date
defaults to 0 which means the resource expires immediately.

When XEP needs the image for the second time it can't simply use the
data from cache as it's expired, so it sends a request, but set's
"/If-Modified-Since" /header. But pythons simple http.servers doesn't
care about If-Modified-Since and simply sends the image again. XEP
checks modification date and as it's the same as cashed data's XEP
actually uses cashed data!

Actually starting from Python 3.7 http.server supports
If-Modified-Since. So I've updated python and now http.server returns
"304 Not Modified" instead of sending "200 OK" and image once again.

python 3.6.5

python 3.8.5

Therefore the solution for your issue is to make your server set
"Expires" header.

-- 
Regards,
Alexey Medvedev
RenderX
---
www.renderx.com

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Mon Aug 10 13:51:29 2020

This archive was generated by hypermail 2.1.8 : Mon Aug 10 2020 - 13:51:48 PDT