Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing proxy settings in connection #21

Open
matarum opened this issue May 12, 2020 · 1 comment
Open

missing proxy settings in connection #21

matarum opened this issue May 12, 2020 · 1 comment

Comments

@matarum
Copy link

matarum commented May 12, 2020

i added in private function create_curl_handle(), before:
return $handle;
this code:
` global $CFG;
// check for proxy
if (!empty($CFG->proxyhost) and !is_proxybypass($uri)) {
// SOCKS supported in PHP5 only
if (!empty($CFG->proxytype) and ($CFG->proxytype == 'SOCKS5')) {
if (defined('CURLPROXY_SOCKS5')) {
curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
} else {
curl_close($handle);
print_error( 'socksnotsupported','mnet' );
}
}

		curl_setopt($handle, CURLOPT_HTTPPROXYTUNNEL, false);

		if (empty($CFG->proxyport)) {
			curl_setopt($handle, CURLOPT_PROXY, $CFG->proxyhost);
		} else {
			curl_setopt($handle, CURLOPT_PROXY, $CFG->proxyhost.':'.$CFG->proxyport);
		}

		if (!empty($CFG->proxyuser) and !empty($CFG->proxypassword)) {
			curl_setopt($handle, CURLOPT_PROXYUSERPWD, $CFG->proxyuser.':'.$CFG->proxypassword);
			if (defined('CURLOPT_PROXYAUTH')) {
				// any proxy authentication if PHP 5.1
				curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
			}
		}
	}`

but I cannot create users, maybe should put proxy code somewhere else?

@hertzel-kuriel
Copy link

HI Matarum
Were you able to solve the problem?
We are also trying to use WebEx plugin in Totara placed behind a proxy server but realized it does not use Totara/Moodle proxy settings. I assume the code above is the way to make it use the Proxy settings.
BTW - does it have to use SOCKS5? our proxy supports HTTP.

Hertzel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants