#!/bin/bash

#
# Detect proxy URL via WPAD
#
# Author: Mike Gabriel
# License: GNU General Public License v2 or later

# This new and very short wpad-extract script is a replacement
# for the old (before squeeze) libjavascript-perl based wpad-extract
# script. This version uses libproxy-tools to retrieve the
# proxy URL and thus is much shorter then its predecessor.

proxy_url=$(echo http://www.debian.org | proxy 2>/dev/null | cut -d" " -f1)

# make sure direct:// urls do not make it through to the system config
case "$proxy_url" in
    http:*|https:*)
	echo http_proxy=$proxy_url
	;;
esac

