I refactored this to use an environment variable set when the user runs `drush api-server`. See `api_server_launch()` in http.inc