scutil --proxy

Read the related fields together:

ConfigurationFields to interpret
Fixed HTTPHTTPEnable (0/1), HTTPProxy and HTTPPort
HTTPS or SOCKSTheir corresponding enable, endpoint and port fields
Automatic policyProxyAutoConfigEnable and ProxyAutoConfigURLString

A saved host is not an enabled route. For an enabled HTTP endpoint that the receiving client should use as a fixed proxy, the URL has host then port:

http://proxy.example.net:8080

A PAC URL identifies a script, not that forwarding listener. Exporting it as HTTP_PROXY loses per-destination decisions. The HTTPS category also does not imply TLS to the intermediary.

Review bypass and scoped configuration before flattening the output into variables, and use the actual command-line client's supported interface.

Erthyglow kevrennek