Testing If-Modified-Since with lwp-mirror

This week I created a way for me to post small messages, as there is not yet a good decentralized way to make this happen. One part of this research is how can I create, host and share RSS feeds without using to much bandwidth and server time.

One way we can do this, is by using the features of the HTTP protocol. One of those features is the Last-Modified header. This header allows web servers and user agents to see when a resource was last modified. Together with a If-Modified-Since header we can let our software check if it needs to send the whole body or just the a simple 304 header.

However to make sure if this works as advertised, we need a way to simulate this situation. I use lwp-mirror to test this, which is included with the LWP package from Perl. It mirrors a remote resource to a local file.

Let's start the test. First download your resource to a file with the lwp-mirror command.

lwp-mirror <url> <local_file>

Now download the file again and check if it sends a 304 code now. Then do something that changes the resource on the server. In my case this is done by added a new post. Now download the resource again and see if it sends a new version of the file. Once downloaded, you check if you get another 304 code.

Welcome

My name is Peter Stuifzand. You're reading my personal website.

Profiles