[ANN] ETag include for On-Rev (was Re: Compare files between on-rev and local versions)

Andre Garzia andre at andregarzia.com
Mon Jun 22 12:07:16 EDT 2009


Hello Folks,
I've just created a minimal ETag include file for On-Rev. For those not
familiar with ETags, they are unique identifiers that are sent as HTTP
Headers. When your file change, your ETag for that file also changes. So a
browser or any http client may sent a web request like, give me that file is
the ETag is different from this one, or if it still the same.

For more information on ETags consult Dr. Wik E. Pedia at
http://en.wikipedia.org/wiki/HTTP_ETag

What my include does is set the ETag header for the file that includes it.
So if you have a helloworld.irev file and include "etag.inc" then, an ETag
http header will be set when helloworld.irev is requested, if the file
changes, the ETag changes too.

Another thing it does is expose an ETag function that will comput an ETag
for a given file path.

And there's one more thing: sometimes, you just want to know if
helloworld.irev changed but you don't want to execute it, for this cases,
just pass a url parameter op=etag, like helloworld.irev?op=etag this way the
include will set the ETag and force the engine to exit without running any
further. This of course just works up to the point where the etag is
included, so include it as the first line.

you can check the etag.inc by going to:

http://andregarzia.on-rev.com/scriptviewer.irev?f=etag.inc

(Karma bonus, my script viewer
generates links for downloading compressed copies of the viewed files)

If you're on a unix like system or any system with CURL, you can do a:

curl -v http://andregarzia.on-rev.com/etagtest.irev

and see the ETag header being
sent. So if you want to compare two files, assuming it's a local and a
remote copy, you can simply store the ETag every time you
cache the file, then you just query for it later.

Hope this is useful
andre


-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list