Saturday, April 26, 2014
Just because there's a standard doesn't mean it's consistent
I came across this URL today that has some base64 encoded data in it. Curious as to what it might be, I tossed the data into a base64 decoder only to have it reject the data as bad.
Okay. It certainly looks like base64 encoded data. But the data doesn't match the RFC-2045 specification. Don't tell me there's more than one … oh for heaven's sake! Really? Thirteen variations?
Standards! There are so many to choose from!
An unexpected feature
As I was writing the link to RFC-2045 in the previous post, an idea suddenly struck me—why
should I have to type out the entire URL? I already have a shortcut to link to Amazon (all I have to do is write a link
like <a href="asin:B00BWQW73E">
and
mod_blog
converts it to <a class="book"
href="http://www.amazon.com/exec/obidos/ASIN/B00BWQW73E/conmanlaborat-20">
)
so it shouldn't be that hard to add.
I was fully expecting it to take maybe fifteen minutes or so to add the code, but to my surprise, no code change was required! The configuration file has this bit:
affiliate = { { proto = "asin", link = "http://www.amazon.com/exec/obidos/ASIN/%s/conmanlaborat-20" } }
It was originally intended for affiliate links, but it'll work for this as well. A slight modification:
affiliate = { { proto = "asin", link = "http://www.amazon.com/exec/obidos/ASIN/%s/conmanlaborat-20" }, { proto = "rfc", link = "http://www.ietf.org/rfc/rfc%s.txt" }, }
Now all I have to do is write <a
href="rfc:2045">
and mod_blog
will convert
it to <a
href="http://www.ietf.org/rfc/rfc2045.txt">
. I love it
when stuff like this happens.
Beware typosquatting
When I initially added the links to the IETF RFC database I made a typo. Instead of linking to “I-E-T-F dot O-R-G” I instead typed it as “I-E-F-T dot O-R-G” and … wow. Easily a dozen redirects, probably half a dozen attempts to infect my computer and landing on some company website I never heard of hawking seminars to help you pass Cisco training and certificaitons.
Shudder.