summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-04-18 18:25:25 +0000
committerErmal <eri@pfsense.org>2011-04-18 18:25:56 +0000
commit42c0700392b73968bd32a31fcaeb68e5daeb9958 (patch)
tree92273883fd68d414cdad4e19a7cf46079370128f /etc
parente8503ff4b6c08ed2297d790ada92fb33f26b897e (diff)
downloadpfsense-42c0700392b73968bd32a31fcaeb68e5daeb9958.zip
pfsense-42c0700392b73968bd32a31fcaeb68e5daeb9958.tar.gz
Add an option under advanced->misc to specify a proxy for retreiving pfsense package info or downloading packages.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pfsense-utils.inc29
1 files changed, 26 insertions, 3 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 08ec7d5..be174af 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -703,7 +703,20 @@ function call_pfsense_method($method, $params, $timeout = 0) {
$xmlrpc_base_url = isset($config['system']['altpkgrepo']['enable']) ? $config['system']['altpkgrepo']['xmlrpcbaseurl'] : $g['xmlrpcbaseurl'];
$xmlrpc_path = $g['xmlrpcpath'];
$msg = new XML_RPC_Message($method, array(XML_RPC_Encode($params)));
- $cli = new XML_RPC_Client($xmlrpc_path, $xmlrpc_base_url);
+ $port = 0;
+ $proxyurl = "";
+ $proxyport = 0;
+ $proxyuser = "";
+ $proxypass = "";
+ if (!empty($config['system']['httpproxy']))
+ $proxyurl = $config['system']['httpproxy'];
+ if (!empty($config['system']['httpproxyport']) && is_numeric($config['system']['httpproxyport']))
+ $proxyport = $config['system']['httpproxyport'];
+ if (!empty($config['system']['httpproxyuser']))
+ $proxyuser = $config['system']['httpproxyuser'];
+ if (!empty($config['system']['httpproxypass']))
+ $proxypass = $config['system']['httpproxypass'];
+ $cli = new XML_RPC_Client($xmlrpc_path, $xmlrpc_base_url, $port, $proxyurl, $proxyport, $proxyuser, $proxypass);
// If the ALT PKG Repo has a username/password set, use it.
if($config['system']['altpkgrepo']['username'] &&
$config['system']['altpkgrepo']['password']) {
@@ -1430,7 +1443,7 @@ function get_freebsd_version() {
}
function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout=60, $timeout=0) {
- global $ch, $fout, $file_size, $downloaded;
+ global $ch, $fout, $file_size, $downloaded, $config;
$file_size = 1;
$downloaded = 1;
/* open destination file */
@@ -1452,6 +1465,16 @@ function download_file_with_progress_bar($url_file, $destination_file, $readbody
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
+ if (!empty($config['system']['proxyurl'])) {
+ curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']);
+ if (!empty($config['system']['proxyport']))
+ curl_setopt($ch, CURLOPT_PROXYPORT, $config['system']['proxyport']);
+ if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
+ @curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY | CURLAUTH_ANYSAFE);
+ curl_setopt($ch, CURLOPT_PROXYUSERPASS, "{$config['system']['proxyuser']}:{$config['system']['proxypass']}");
+ }
+ }
+
@curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($fout)
@@ -2158,4 +2181,4 @@ function filter_rules_compare($a, $b) {
return compare_interface_friendly_names($a['interface'], $b['interface']);
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud