1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/bash
# Copyright 2020 Simon McVittie
# SPDX-License-Identifier: LGPL-2.1+
set -eux
set -o pipefail
#export PX_DEBUG=1
reset () {
unset XDG_CURRENT_DESKTOP
unset FTP_PROXY
unset GSETTINGS_BACKEND
unset HTTPS_PROXY
unset HTTP_PROXY
unset KDE_FULL_SESSION
unset NO_PROXY
unset ftp_proxy
unset http_proxy
unset https_proxy
unset no_proxy
}
reset
export XDG_CURRENT_DESKTOP=GNOME
export GSETTINGS_BACKEND=keyfile
export XDG_CONFIG_HOME="$AUTOPKGTEST_TMP/config"
mkdir -p "$XDG_CONFIG_HOME/glib-2.0/settings"
cat > "$XDG_CONFIG_HOME/glib-2.0/settings/keyfile" <<'EOF'
[system/proxy]
autoconfig-url=''
ignore-hosts=['localhost']
mode='manual'
use-same-proxy=false
[system/proxy/ftp]
host='ftpproxy.example.net'
port=8000
[system/proxy/http]
host='proxy.example.net'
port=8000
[system/proxy/https]
host='sslproxy.example.net'
port=8000
[system/proxy/socks]
host='socksproxy.example.net'
port=8000
EOF
answer="$(proxy http://example.com)"
test "${answer}" = "http://proxy.example.net:8000"
answer="$(proxy https://example.com)"
test "${answer}" = "http://sslproxy.example.net:8000"
answer="$(proxy ftp://ftp.example.com)"
test "${answer}" = "http://ftpproxy.example.net:8000"
answer="$(proxy http://localhost)"
test "${answer}" = direct://
|