Factored Out HTTP Independent Code

Factored out code from the http project which does not relate to the
HTTP protocol.