Add log statements.
Move common http code to httpcommon.go