C library for the Public Suffix List
Go to file
Tim Rühsen 5c159a3a09 Add few more tests to test-is-public-builtin.c 2016-01-01 22:34:55 +01:00
contrib Fix ./configure --disable-runtime 2015-12-26 14:15:08 +01:00
docs/libpsl Remove psl_builtin_compile_time() for reproducable builds 2016-01-01 15:44:24 +01:00
include Remove psl_builtin_compile_time() for reproducable builds 2016-01-01 15:44:24 +01:00
list@1f3ad51171 New function psl_is_public_suffix2() 2015-12-06 21:55:56 +01:00
po autoconf first version 2014-03-20 22:43:04 +01:00
src Fix make_dafsa.py to generate 4 bit return values 2016-01-01 22:32:11 +01:00
tests Add few more tests to test-is-public-builtin.c 2016-01-01 22:34:55 +01:00
tools Remove psl_builtin_compile_time() for reproducable builds 2016-01-01 15:44:24 +01:00
.dir-locals.el document indentation conventions for emacs users 2014-03-21 14:39:17 -04:00
.gitignore Add gtk-doc.m4 and include/libpsl.h to .gitignore 2015-09-23 14:16:52 +02:00
.gitmodules Add https://github.com/publicsuffix as git submodule 2015-07-14 13:25:42 +02:00
.travis.yml Revert "Remove ./configure --disable-runtime" 2015-12-25 19:40:24 +01:00
ABOUT-NLS autoconf first version 2014-03-20 22:43:04 +01:00
AUTHORS Use DAWG/DAFSA format for builtin data 2015-12-09 09:35:04 +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 Copy custom PSL file and test file into distribution tarball 2015-11-19 11:16:24 +01:00
NEWS Correct the present year 2015-10-07 13:28:02 +02:00
README inital commit 2014-03-20 17:17:24 +01:00
README.md Use DAWG/DAFSA format for builtin data 2015-12-09 09:35:04 +01:00
autogen.sh Fix Shebang line and other issues with autogen.sh 2015-12-03 10:10:25 +01:00
configure.ac Avoid libicu dependency with --enable-runtime=no 2015-12-26 14:44:57 +01:00
libpsl.pc.in Fixed pkg-config file 2014-11-14 11:40:29 +01:00

README.md

Build Status

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 (libicu is used by psl2c if installed)

Find more information about the Publix 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.

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/make_dafsa.py and src/lookup_string_in_fixed_set.c are licensed under the term written in src/LICENSE.chromium.

Building from git

Download project and prepare sources with

	git clone http://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.