Restructuring

I split out the HTML header/footer, created a proper parser for Content-Type and Content-Disposition headers, made the whole thing run in a subdirectory and allowed local configurations.