<commit_before>expurgate
=========

Running an SSL site? Don&#39;t want mixed content? Expurgate lets you serve non-HTTPS content over HTTPS!<commit_msg>Update README to reflect initial functionality.<commit_after># expurgate

Running an SSL site? Don't want mixed content warnings? Expurgate lets you serve external, non-HTTPS content over HTTPS!

## How it works

Server-side, you route all your HTTP calls to images to an HTTPS call to expurgate, which might look like:

	https://example.com/expurgate.php?checksum=foo&url=http://example.net/foo.jpg

Expurgate will then fetch http://example.net/foo.jpg and serve it over SSL — meaning that every request on your page is still encrypted, and your users see no mixed content warnings.

## What's this checksum?

So that not just anyone can request images — which would make you, in effect, a free image hosting service — the code calling expurgate is expected to generate a checksum to authenticate its request. This is an SHA-256 [HMAC][] value, based on a shared secret known by both the calling code and expurgate — but not by the viewer of the page.

[HMAC]: http://en.wikipedia.org/wiki/HMAC

So, to generate the checksum in the above example, the calling code would look like:

	<?php
	$url = 'http://example.net/foo.jpg';

	$key = file_get_contents('cache/key.txt');

	$checksum = hash_hmac('sha256', $url, $key);
	?>

	<img src="https://example.com/expurgate.php?checksum=<?php echo $checksum ?>&url=<?php echo urlencode($url) ?>" />

## Requirements

PHP >5.2.0 with hash functions.
{'fraction_non_alphanumeric': 0.10369410239792612, 'fraction_numerical': 0.007128969539857421, 'mean_word_length': 4.594202898550725, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5227401', 'n_tokens_mistral': 472, 'n_tokens_neox': 453, 'n_words': 198}