Overhauled the whole input stream handling system to be more HTTP compliant and easier to work with.