Refactoring http.rb