refactored http.  Fix tests.