One hosting operation, two transports
The email operation I want hasn’t changed: ask cPanel to list accounts for a domain. How I reach cPanel can change.
The December connector refactor gives my email-management code an HTTP connector and an SSH connector. Both expose make_call, taking a module, function, and parameters.
That keeps the email method from needing to assemble an HTTP request in one case and a shell command in the other.

Illustration: choosing one of two routes for a delivery.
The selection is explicit
Connector has API and SSH members. CpanelEmail receives the selected member and creates its connector.
In this server revision, the entry point looks up the supplied name directly in the enum, so the names are uppercase. Selecting SSH doesn’t mean “try HTTP and switch if it fails.” There is no automatic failover in this selection path.
That matters when reading an error. I need to know which transport I asked the program to use. An HTTP response and an SSH exit status describe different parts of the system.
What each connector needs
| Connector | Configuration used for the connection |
|---|---|
| HTTP | Hostname, cPanel username, API token, port, and TLS selection. |
| SSH | Server address, cPanel username, private-key path, and SSH port. |
The shared operation can still supply Email, list_pops, and a dummy domain. The connector decides how to carry that request.
HTTP sends query parameters to the UAPI endpoint. SSH starts the local SSH client and asks the remote account to run uapi.
The December 19 SSH follow-up changes the remote command to use --output=jsonpretty and expand the parameters as key/value arguments. For a harmless teaching example, the remote command has this shape:
uapi --output=jsonpretty Email list_pops domain='example.com'
The common method doesn’t make the responses identical
The HTTP connector returns parsed JSON. The SSH connector captures process output and returns the stdout string under a response key, with an error entry when the process exits unsuccessfully.
For tests, I can supply fake results at either boundary. But a dictionary containing JSON text isn’t the same thing as the parsed JSON object inside that text. Code above the connector needs to account for that before claiming transport-independent result handling.
There is also another parser in the SSH path. The local subprocess uses an argument list, but one argument contains a remote command interpreted by the remote shell.
The implementation wraps each parameter value in single quotes. That works for the simple domain above. A value containing its own single quote needs proper shell escaping; surrounding arbitrary text with quotes doesn’t establish that it is safe. That needs a focused quoting check, not an assumption based on the local argument list.