[FreeBSD] HTTP_PROXY variable makes Restic commands failed

Host OS: FreeBSD 13.2-RELEASE amd64 GENERIC
Restic version: restic-0.15.2 (installed via pkg install -y restic)
Rest-server version: rest-server-0.11.0_13 (installed via pkg install -y rest-server-0.11.0_13)

Using HTTP_PROXY variable in /home/username/.cshrc on client side makes restic commands failed. For example:

# restic -r rest:http://192.168.10.100:8000/ init                    
enter password for new repository:                                                                                                                                                             
enter password again:                                                                          
Fatal: create repository at rest:http://192.168.10.100:8000/ failed: Fatal: server response unexpected: 403 Forbidden (403)

Squid proxy log:

1685086691.905 0 192.168.10.200 TCP_DENIED/403 326 HEAD http://192.168.10.100:8000/config - HIER_NONE/- text/html [User-Agent: Go-http-client/1.1\r\nAccept: application/vnd.x.restic.rest.v2\r\nHost: 192.168.10.100:8000\r\n] [HTTP/1.1 403 Forbidden\r\nServer: squid\r\nMime-Version: 1.0\r\nDate: Fri, 26 May 2023 07:38:11 GMT\r\nContent-Type: text/html;charset=utf-8\r\nContent-Length: 3548\r\nX-Squid-Error: ERR_ACCESS_DENIED 0\r\nVary: Accept-Language\r\nContent-Language: en\r\nX-Cache: MISS from unknown\r\nX-Cache-Lookup: NONE from unknown:3128\r\nConnection: close\r\n\r\n]

After unsetting HTTP_PROXY variable (# unsetenv HTTP_PROXY) restic works as expected

Questions:

  1. Is it possible to prevent restic using variable without unsetting HTTP_PROXY?
  2. Is it possible to implement option to restic code something like --use-proxy http://proxy_server_ip:port or --no-proxy?

Just run restic using HTTP_PROXY= restic -r rest:http://192.168.10.100:8000/ init

setenv HTTP_PROXY && restic -r rest:http://192.168.10.100:8000/ init

It’s not so convinient way but working and unfortunately it resets HTTP_PROXY variable globally.