I ditched Maxmind

23, 25 and

International copyright legislation

Many countries apply a seventy year copyright term. That means seventy years after the author died, the copyright will expire at the start of the next year. Clear and simple.

However in March 2020 I discovered that some countries, notably the United States of America, have special rules for posthumous works. If I interpret the rather complicated rules correctly, a work probably created between 1902 and 1905, but first published in 1988, written by Fernando Pessoa who died in 1935, will remain under copyright protec­tion in the USA until 2047! In 2020 I wrote about this in Interlingua.

Publishing a derived work of a protected work, such as a translation, requires permission, which I don’t have. So my cautious conclusion, not being a lawyer, was that it would be illegal to publish my 2018 translation into Interlingua of Pessoa’s A hora do diabo in the USA. Offering it on a web page is a form of publication.

Therefore I no longer directly offer the page as an HTML file, but I put a CGI program in between. That program takes the IP address of the website visitor, and derives an ISO 3166 country code from it. If that code is US, CA (Canada), GB (Great Britain and Northern Ireland), IM (Isle of Man) or (added 25 November 2025) UK (United Kingdom), I don’t show the page with the original and the translation side-by-side, but instead an explanatory text about the legal situation, in English, Interlingua and Portuguese.

I included the extra countries, in addition to the USA, because some of the legislation is very complicated, and impossible to interpret with certainty for me as a non-lawyer. So to stay on the safe side, I don’t display the page to visitors from those countries either.

Software

This worked well for years. I used functions from a library supplied by Maxmind.com, which consults a downloadable database from that same company.

However, when recently I felt the need to reinstall my website on a fresh VPS (Virtual Private Server), I noticed that the database hadn’t been downloaded. As a result, when consulting A hora do diabo / Le hora del diabolo the server displayed an error message.

I inspected the database on the old VPS (then still available), and noticed the date: 2 April 2024. So it seems the monthly database update which I scheduled in root’s crontab, which downloads a complete, new, compressed database, has not succeeded in over a year? I should have noticed, but I hadn’t.

So when I had time (very busy period lately) I tried to fix the problem, tried the commands in the shell script I use for it, and several other variants suggested to me on Maxmind.com’s site, after logging in there with the account I still have. Unfortunately, nothing worked. I got an error message, or just an empty file, whatever I did. I created a fresh key. To no avail.

After a while I got fed up with it. I’m not saying this is Maxmind’s fault, no doubt _I_ keep making a mistake somewhere. But I just couldn’t find it. And I wondered if there wasn’t a simpler solution. So I decided to ask grok.com. Not because it always has everything right. It hasn’t. But it seems to be better at Information Technology issues than in other fields.

Grok.com came up with five online commands, all using curl.

ServiceOne-line cURL exampleReturns ISO code asNotes
ipapi.iscurl https://api.ipapi.is/?q=8.8.8.8iso : US Very fast, generous free tier
ipinfo.iocurl https://ipinfo.io/8.8.8.8/countryUS (just the code) 50 000 requests/month free
ip-api.comcurl http://ip-api.com/json/8.8.8.8?fields=countryCode {"countryCode":"US"} Free for non-commercial use
ipgeolocation.io curl https://api.ipgeolocation.io/ipgeo?apiKey=YOUR_FREE_KEY&ip=8.8.8.8 "country_code2": "US" Free 30k/month
db-ip.comcurl https://api.db-ip.com/v2/free/8.8.8.8/countryCodeUS Completely free (no key needed)

Looking at the various sites, I am not sure Grok’s info is accurate about free and non-free accesses. But the fact is, the four command examples (I skipped the one that requires an apiKey) do work! So I made good use of them.

My software

The existing 19782047.c remained largely unchanged. I only added the country code UK for United Kingdom of Great Britain and Northern Ireland, which in future might become more widespread than the current slightly incorrect, but still official code GB.

In IP2cntr.c I disabled the old code by putting it between
#if 0
and
#endif
and wrote new code which can use all four sites and commands. As soon as one produces a valid result, the loop stops and that country code is used. This ensures that if in future one of the services gets out of business, another one automatically takes over, without requiring program changes. The same is true if a service might return an error message due to too many requests per day. Unlikely, but possible.