[links-list] Cyclic redirect, cookies, and caching

Daniel Reed n at cs.rpi.edu
Sun Nov 10 11:49:16 PST 2002

Links 2.1pre6

It appears links can be a bit overzealous in its page caching. It looks like
in a situation where a web page sets a cookie, and at the same time
redirects the browser to itself (so the cookie can take affect), Links gives
an error stating "Cyclic redirect," which arguably is not the Right Thing. I
have seen other examples where a page will set a cookie and merely link to
itself, and when I select the link, Links adds the page a second time in my
history but otherwise does nothing (hitting Backspace leaves me at the same
page until I hit it a second time).

The way many browsers seem to get around this is to simply always send a
GET, but include an only-if-modified-since header with the request (I don't
recall what it is offhand), resulting in a 304 response from the server if
your copy is as new as the server copy.

Alternatively, if sheer responsiveness is the priority, Links might be made
to keep track of its own state at the time a cached page was requested, and
allow future requests to only match the cached copy if the states match
(which could be done simply by keeping track of the full request string sent
to the server for each cached page, and constructing a new one and simply
strcmp()'ing it with each of the cached ones).

In the interim, setting the size of the memory cache to 0kB seems to
workaround the issue.

Daniel Reed <n at cs.rpi.edu>
naim FAQ:

Unsubscribe: send email to links-list-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message

More information about the links-list mailing list