_http_agent: refactored .getName code