Move http-level functions into http module