refactor http server