Category Archives: Web

Modified or not?

According to Sam Ruby, WordPress (among others) isn’t responding as expected to being sent If-None-Match and/or If-Modified-Since HTTP headers.

I’ve tried replicating the experiment with WordPress 2.0.2, 2.0.2 and 2.0.4 — they all yield the same results:

ETag: "1a0c3e00da9d1d0a6e145168720f8574"
Last-Modified: Thu, 23 Nov 2006 01:20:07 GMT
> HEAD -H 'If-Modified-Since: Thu, 23 Nov 2006 01:20:07 GMT'
Status: 304 Not Modified
> HEAD -H 'If-None-Match: "1a0c3e00da9d1d0a6e145168720f8574"'
Status: 304 Not Modified
> HEAD -H 'If-Modified-Since: Thu, 23 Nov 2006 01:20:07 GMT' -H 'If-None-Match: "1a0c3e00da9d1d0a6e145168720f8574"'
Status: 304 Not Modified
> HEAD -H 'If-Modified-Since: Thu, 23 Nov 2005 01:20:07 GMT' -H 'If-None-Match: "1a0c3e00da9d1d0a6e145168720f8574"'
Status: 200 OK
> HEAD -H 'If-Modified-Since: Thu, 23 Nov 2006 01:20:07 GMT' -H 'If-None-Match: "1a0c3e00da9d1d0a6e145168720f8579"'
Status: 200 OK

This seems to be working fine, or at least according to plan.

I originally suspected the reason Sam and others were getting it wrong was the use of double quotes in the ETag value, but on the other hand I can reproduce the problem with the feed from webstandards (apparently running version 2.0.2), so it seems the problem might be related to something specific to some sites, not to WordPress itself.

WP: Venus

Planet SF has been running WordPress with the FeedWordPress plugin for a while now, but it just didn’t work very well — posts were duplicated, and multiauthor blogs weren’t handled well.

Instead of fixing it, I decided to go with Planet Planet instead. Well, sort of.

Sam Ruby has put a lot of work into a refactoring of the Planet Planet code, the result being Planet Venus. Among the most significant changes is the use of a cache directory containing Atom entries as individual files. This makes it easy to slurp the posts into WordPress, which has the advantage of giving easy access to historic posts, categories and users etc.

Prompted by a question on the planet development list I finally got around to putting together a plugin that would power a WordPress installation through the use of Planet Venus.

Installation and use of the WordPress Venus plugin (svn) is straight forward — dump it in the wp-content/plugins folder, activate it from the plugins option screen, and go to the Venus option screen to configure its options: Path to Planet Venus cache directory, update interval and whether to link from posts back to their source.

Update: This plugin now lives in the WordPress Plugin Repository.

Why REST Matters

Try this:

  1. Go to
  2. Open a story from the front page in a new window or tab (via the More… link).
  3. Open another story in yet another new window or tab.
  4. Switch to the window or tab from step 2.
  5. Login (using the Ajax widget in the left column).

Notice how your window or tab opened in step 2 now contains the article that was opened in step 3?

Clearly, digg doesn’t use or understand web architecture. Somewhere on their server they try to store session information, under the assumption that one user equals one browser, one window, and one tab.

If instead of using session information (through cookies), they actually used the principles of the web and Representational State Transfer (REST), I would end up with the story I was actually reading, not some other story I happened to have opened at a later point.