Cleanup

This changeset fixes a few inconsistencies in the signature generation code and adds a ``Content-Length`` and ``User-Agent`` header.