Sunday, May 01, 2022
A zombie site from May Days past
Given that today is May Day I was curious as to what I wrote on past May Days.
And lo'
sixteen years ago I wrote about OsiXs.org
and their attempt to “change the world!”
Amazingly,
the website is still around,
although with even less than there was sixteen years ago.
I guess I was right when I wrote back then,
“I personally don't see this going anywhere fast.”
It was a simple bug, but …
I was right about the double slash bug—it was a simple bug after all. The authors of two Gemini crawlers wrote in about the double slash bug, and from them, I was able to get the root cause of the problem—my blog on Gemini. Good thing I hedged my statement about not being the cause yesterday. Sigh.
Back in Debtember, I added support for displaying multiple posts. It's not an easy feature to describe, but basically, it allows one to (by hacking the URL, but who hacks URLs these days?) specify posts via a range of dates. And it's on these pages that the double slashed URLs appear. Why that happens is easy—I was generating the links directly from strings:
local function geminilink(entry) return string.format("gemini://%s%s/%s%04d/%02d/%02d.%d", config.url.host, port, -- generated elsewhere config.url.path, entry.when.year, entry.when.month, entry.when.day, entry.when.part ) end
instead of from a URL type.
I think when I wrote the above code,
I wasn't thinking in terms of a URL type,
but of constructing a URL from data I already had.
The bug itself is due to config.url.path
ending in a slash,
so the third slash in the string literal wasn't needed.
The correct way isn't that hard:
local function geminilink(entry) return uurl.toa(uurl.merge(config.url, { path = string.format("%04d/%02d/%02d.%d", entry.when.year, entry.when.month, entry.when.day, entry.when.part) })) end
and it wouldn't have exhibited the issue.
With this fix in place, I think I will continue to reject requests with the double slash, as it is catching bugs, which is a Good Thing™.