Project

General

Profile

« Previous | Next » 

Revision 1fa63e8d

Added by Steve Beaver over 4 years ago

Fixed #11464 by adding proxy configuration to web service calls

(cherry picked from commit 2cb3c56db2366c9cadb04757bd3143ea0d7e7378)

View differences:

src/etc/inc/copyget.inc
36 36
// Poll the Netgate server to obtain the JSON/HTML formatted support information
37 37
// and write it to the JSON file
38 38
function updatecopyright() {
39
	global $g, $copyrightfile, $tmpfile, $idfile, $FQDN;
39
	global $g, $copyrightfile, $tmpfile, $idfile, $FQDN, $config;
40 40

  
41 41
	if (file_exists($idfile)) {
42 42
		if (function_exists('curl_version')) {
......
52 52
			curl_setopt($ch, CURLOPT_POST, true);
53 53
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
54 54
			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,4);
55

  
56
			if (!empty($config['system']['proxyurl'])) {
57
				curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']);
58
				if (!empty($config['system']['proxyport'])) {
59
					curl_setopt($ch, CURLOPT_PROXYPORT, $config['system']['proxyport']);
60
				}
61
				if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
62
					@curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY | CURLAUTH_ANYSAFE);
63
					curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$config['system']['proxyuser']}:{$config['system']['proxypass']}");
64
				}
65
			}
66

  
55 67
			$response = curl_exec($ch);
56 68
			$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
57 69
			curl_close($ch);
src/etc/inc/pkg-utils.inc
1614 1614
		curl_setopt($ch, CURLOPT_HEADER, 0);
1615 1615
		curl_setopt($ch, CURLOPT_VERBOSE, 0);
1616 1616
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1617
		curl_setopt($ch, CURLOPT_USERAGENT, $g['product_label'] . '/' .
1618
		    $g['product_version']);
1617
		curl_setopt($ch, CURLOPT_USERAGENT, $g['product_label'] . '/' . $g['product_version']);
1619 1618
		curl_setopt($ch, CURLOPT_URL, $FQDN);
1620 1619
		curl_setopt($ch, CURLOPT_POST, true);
1621 1620
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
1622 1621
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,4);
1622

  
1623
		if (!empty($config['system']['proxyurl'])) {
1624
			curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']);
1625
			if (!empty($config['system']['proxyport'])) {
1626
				curl_setopt($ch, CURLOPT_PROXYPORT, $config['system']['proxyport']);
1627
			}
1628
			if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
1629
				@curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY | CURLAUTH_ANYSAFE);
1630
				curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$config['system']['proxyuser']}:{$config['system']['proxypass']}");
1631
			}
1632
		}
1633

  
1623 1634
		$response = curl_exec($ch);
1624 1635
		$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
1636

  
1625 1637
		curl_close($ch);
1626 1638

  
1627 1639
		if ($status == 200) {
src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php
74 74
// Poll the Netgate server to obtain the JSON/HTML formatted support information
75 75
// and write it to the JSON file
76 76
function updateSupport() {
77
	global $g, $supportfile, $idfile, $FQDN;
77
	global $g, $supportfile, $idfile, $FQDN, $config;
78 78

  
79 79
	if (file_exists($idfile)) {
80 80
		if (function_exists('curl_version')) {
......
90 90
			curl_setopt($ch, CURLOPT_POST, true);
91 91
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
92 92
			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,4);
93

  
94
			if (!empty($config['system']['proxyurl'])) {
95
				curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']);
96
				if (!empty($config['system']['proxyport'])) {
97
					curl_setopt($ch, CURLOPT_PROXYPORT, $config['system']['proxyport']);
98
				}
99
				if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
100
					@curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY | CURLAUTH_ANYSAFE);
101
					curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$config['system']['proxyuser']}:{$config['system']['proxypass']}");
102
				}
103
			}
104

  
93 105
			$response = curl_exec($ch);
94 106
			$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
95 107
			curl_close($ch);

Also available in: Unified diff