3 ms·
I wrote 2 implementations for ETag, one using plain text files and one using a database file: https://cup.github.io/autumn/talk-conditional-request https://cup
by svnpenn 7y ago
I wrote 2 implementations for ETag, one using plain text files and one using a database file:
https://cup.github.io/autumn/talk-conditional-request https://cup.github.io/autumn/talk-conditional-request
My implementations are in PHP, but they could easily be adapted to other languages. I was surprised when I found that cURL really doesnt have support for this. Yeah, you can do something like this:
$ curl -I -H 'If-None-Match: "109-55035a2e5a100"' \
> speedtest.lax.hivelocity.net
HTTP/1.1 304 Not Modified
but its of limited usefulness. What you need is a cache storing all the requests youve made, so that the next time you make a request the cache can be checked. Without the cache its pointless. Also a problem is that some sites only return Last-Modified, not ETag:
$ curl -I https://en.wikipedia.org/wiki/Main_Page
last-modified: Sun, 03 Nov 2019 20:12:16 GMT
and some dont return either:
https://www.google.com https://www.google.com