Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLD updates no longer available #81

Open
jdiner opened this issue Feb 24, 2017 · 2 comments
Open

TLD updates no longer available #81

jdiner opened this issue Feb 24, 2017 · 2 comments

Comments

@jdiner
Copy link

jdiner commented Feb 24, 2017

TLD updates are no longer working. After running:

  faup -u

the mozilla.tlds file contains only an error message:

  HTTP/1.1 404 Not Found^M
  Date: Fri, 24 Feb 2017 16:35:35 GMT^M
  Server: Apache/2.4.10 (Debian)^M
  Content-Length: 298^M
  Connection: close^M
  Content-Type: text/html; charset=iso-8859-1^M
  ^M
  <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  <html><head>
  <title>404 Not Found</title>
  </head><body>
  <h1>Not Found</h1>
  <p>The requested URL /effective_tld_names.dat was not found on this server.</p>
  <hr>
  <address>Apache/2.4.10 (Debian) Server at io.libio.so Port 80</address>
  </body></html>

I've confirmed this issue on multiple clients and networks. It appears that the TLD update endpoint has disappeared.

Also note that this issue renders libfaup unable to provide useful TLD information for parsed URLs. This is because the mozilla.tlds file is overwritten even if the update fails, rather than keeping the old mozilla.tlds data.

@jdiner
Copy link
Author

jdiner commented Feb 28, 2017

I've created a workaround that I'd like to share in case anyone else needs public suffix list updates. It's a bash script that downloads the latest data via curl. It should be run in the directory where the mozilla.tlds file is stored. It maintains a backup of the previous mozilla.tlds file and reverts to it if the download fails.

#!/bin/bash

# Keep backup
mv mozilla.tlds mozilla.tlds.bak 2> /dev/null

# Download latest list
curl "https://publicsuffix.org/list/public_suffix_list.dat" -k -s > mozilla.tlds 2> /dev/null

if [ $? -ne 0 ]; then
    # Failed, restore backup
    rm -f mozilla.tlds
    mv mozilla.tlds.bak mozilla.tlds 2> /dev/null
    exit -1
fi

# Check for success
size=`stat -c '%s' mozilla.tlds`
if (( $size < 100000 )); then
    # Too small to be valid, restore backup
    rm -f mozilla.tlds
    mv mozilla.tlds.bak mozilla.tlds 2> /dev/null
    exit -1
fi

# Clean up backup
rm -f mozilla.tlds.bak

exit 0

@stricaud
Copy link
Owner

Thanks. Will see what I can do upstream as soon as I find some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants