C library for the Public Suffix List
Go to file
Tim Rühsen 159fb8c2f5 Release v0.16.0
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEHLJ9vJhhSy1YQWRtCDAttqJnBCgFAlhMNkYACgkQCDAttqJn
 BCgO9w/7BopUogD/t2vDPm3CvTdlgJHvxlkYfG74DU/Qoxmh8XW2gfshsEOlY7TM
 PAew4V2R+JkKH1gJXyFdLofWF/pFDrzEoUG+ymFBNJ8Y8u++Hf4/6JagH706tarL
 zjDCEF6U4HXF6JHr9hvXbdc7g98Qo0+Ymro2O/ruNbZbP01unzNFIj3pa6zhvMeB
 rp0iir8i+kjMrUpnXkry8KblQ5UY9m/6DTCGOkmnKb9q+v1eHNWCCCnenlqQPsJ6
 VR5rNN38UpUlqDVsifaVSxJWnRo5CH57sZxXGQjZqsxhy0/vWq9kBNwNkDZbb9E7
 o7Dhu/WEE/5tQQLyJKVmWilVm1MEYvTmkNyW067+f9OGwMYuFudcw3PaFh6V/dou
 5Y1KSTQQBuaA6q9SmTw8C57x6VHuBRmJ2qI4RR+ruvqCjW8twOI2izQ/0MF9TWVG
 UQB+iJ6OxSQjvTtA1LdvI4/K038OIgtpV12QYGfFm9iMfsGylOQUJhG0QpDZb298
 +aikwnXdMqSqSqp17XFFE49xE+yrRGUpv3cYLThc2GWULd6mI4b5oikRE6eC5FOB
 jZ65TJu/Yp6lVJmb+kj4JcEnJlsEt7CMDp0xCkCYrWFwGYZgPhCLVPrEDFNAjf5F
 sAdHTR6h8OM6KdpPGOoyTCFXpFbQRkZTk5NeGZxi8okxd8hi5q4=
 =w6xS
 -----END PGP SIGNATURE-----

Merge tag 'libpsl-0.16.0' into debian

Release v0.16.0
2016-12-10 18:41:35 +01:00
contrib Add 'make clean' to contrib/check-hard 2016-09-22 11:19:30 +02:00
debian preparing new upstream release 0.15.0 2016-11-15 08:42:41 +09:00
docs/libpsl Add functions psl_latest() and psl_dist_filename() 2016-12-06 20:16:12 +01:00
include Add functions psl_latest() and psl_dist_filename() 2016-12-06 20:16:12 +01:00
list@41a519ad34 Update PSL submodule 2016-11-14 12:36:16 +01:00
po autoconf first version 2014-03-20 22:43:04 +01:00
src Add functions psl_latest() and psl_dist_filename() 2016-12-06 20:16:12 +01:00
tests s/Publix/Public/ 2016-12-07 16:14:04 +08:00
tools Add functions psl_latest() and psl_dist_filename() 2016-12-06 20:16:12 +01:00
.dir-locals.el document indentation conventions for emacs users 2014-03-21 14:39:17 -04:00
.gitignore Add test DAFSA files to .gitignore 2016-11-06 11:30:20 +01:00
.gitmodules Add https://github.com/publicsuffix as git submodule 2015-07-14 13:25:42 +02:00
.travis.yml Add Solaris OpenCSW badges 2016-11-04 14:28:30 +01:00
.travis_coveralls.sh Add Travis script for Coveralls.io 2016-09-28 12:31:49 +02:00
AUTHORS Add Daurnimator to AUTHORS 2016-11-06 16:22:52 +01:00
COPYING Update copyright years 2015-09-23 14:50:01 +02:00
LICENSE Update copyright years 2015-09-23 14:50:01 +02:00
Makefile.am Replace psl2c by psl-make-dafsa 2016-12-06 15:22:18 +01:00
NEWS Release v0.16.0 2016-12-10 18:06:44 +01:00
README inital commit 2014-03-20 17:17:24 +01:00
README.md s/Publix/Public/ 2016-12-07 16:14:04 +08:00
autogen.sh Let autogen.sh work on Solaris and without gtkdocize 2016-01-02 13:01:19 +01:00
configure.ac Release v0.16.0 2016-12-10 18:06:44 +01:00
libpsl.pc.in s/Publix/Public/ 2016-12-07 16:14:04 +08:00

README.md

Travis-CI Status Coverity Scan Coverage Status

Solaris OpenCSW Build Status Solaris amd64 Build Status Solaris i386 Build Status Solaris Sparc Build Status Solaris SparcV9

libpsl - C library to handle the Public Suffix List

A "public suffix" is a domain name under which Internet users can directly register own names.

Browsers and other web clients can use it to

  • avoid privacy-leaking "supercookies"
  • avoid privacy-leaking "super domain" certificates (see post from Jeffry Walton)
  • domain highlighting parts of the domain in a user interface
  • sorting domain lists by site

Libpsl...

  • has built-in PSL data for fast access (DAWG/DAFSA reduces size from 180kB to ~32kB)
  • allows to load PSL data from files
  • checks if a given domain is a "public suffix"
  • provides immediate cookie domain verification
  • finds the longest public part of a given domain
  • finds the shortest private part of a given domain
  • works with international domains (UTF-8 and IDNA2008 Punycode)
  • is thread-safe
  • handles IDNA2008 UTS#46 (if libicu is available)

Find more information about the Public Suffix List here.

Download the Public Suffix List here.

The DAFSA code has been taken from Chromium Project.

API Documentation

You find the current API documentation here.

Quick API example

#include <stdio.h>
#include <libpsl.h>

int main(int argc, char **argv)
{
	const char *domain = "www.example.com";
	const char *cookie_domain = ".com";
	const psl_ctx_t *psl = psl_builtin();
	int is_public, is_acceptable;

	is_public = psl_is_public_suffix(psl, domain);
	printf("%s %s a public suffix.\n", domain, is_public ? "is" : "is not");

	is_acceptable = psl_is_cookie_domain_acceptable(psl, domain, cookie_domain);
	printf("cookie domain '%s' %s acceptable for domain '%s'.\n",
		cookie_domain, is_acceptable ? "is" : "is not", domain);

	return 0;
}

Command Line Tool

Libpsl comes with a tool 'psl' that gives you access to most of the library API via command line.

$ psl --help

prints the usage.

Convert PSL into DAFSA

The DAFSA format is a compressed representation of strings. Here we use it to reduce the whole PSL to about 32k in size.

Generate psl.dafsa from list/public_suffix_list.dat

$ src/psl-make-dafsa --output-format=binary list/public_suffix_list.dat psl.dafsa

Test the result (example)

$ tools/psl --load-psl-file psl.dafsa aeroclub.aero

License

Libpsl is made available under the terms of the MIT license.
See the LICENSE file that accompanies this distribution for the full text of the license.

src/psl-make-dafsa and src/lookup_string_in_fixed_set.c are licensed under the term written in src/LICENSE.chromium.

Building from git

You should have python2.7+ installed.

Download project and prepare sources with

	git clone https://github.com/rockdaboot/libpsl
	./autogen.sh
	./configure
	make
	make check

Mailing List

Mailing List Archive

Mailing List

To join the mailing list send an email to

libpsl-bugs+subscribe@googlegroups.com

and follow the instructions provided by the answer mail.

Or click join.