refactored HttpProtocol