Setting a proxy user and password
-
Hi there.
I have used Broken Link Checker for a long time until our server admin changed a server setting which broke the plugin functionality. He did this on purpose – and gave an explanation for his decision (see the summary of his statement below). He changed a few lines of the plugin code and BLC is now working. He sent me some wording for a message to you in case you wanted to make the change part of the official BLC code. Here’s what he wrote:
Summary: We have a restricted set of URLs that our WordPress environment is allowed to connect to. This is accomplished by routing outbound WordPress traffic through an HTTP forward proxy server. However, the link checker needs to be able to reach pretty much anything on the internet, so I made some small changes to do the following: 1) Add an option in the BLC admin screen to set a proxy user and password, 2) if these configuration items exist, BLC will use those credentials for proxy authentication instead of those set in the wp_config.php.
Here is the code snippet he sent me to share with you:
diff -r broken-link-checker-orig/legacy/core/core.php broken-link-checker-fork-2.2.2/legacy/core/core.php
680a681,684//http_proxy
$this->conf->options[‘proxy_un’] = ! empty( $_POST[‘proxy_un’] ) ? $_POST[‘proxy_un’] : ”;
$this->conf->options[‘proxy_pw’] = ! empty( $_POST[‘proxy_pw’] ) ? $_POST[‘proxy_pw’] : ”;1222a1227,1264
type=”text”
name=”proxy_un”
id=”proxy_un”
value=””
class=”regular-text ltr”>type=”password”
name=”proxy_pw”
id=”proxy_pw”
value=””
class=”regular-text ltr”>diff -r broken-link-checker-orig/legacy/core/init.php broken-link-checker-fork-2.2.2/legacy/core/init.php
106a107,108
‘proxy_un’ => ”,
‘proxy_pw’ => ”,
diff -r broken-link-checker-orig/legacy/init.php broken-link-checker-fork-2.2.2/legacy/init.php
123a124,125
‘proxy_un’ => ”,
‘proxy_pw’ => ”,
diff -r broken-link-checker-orig/legacy/modules/checkers/http.php broken-link-checker-fork-2.2.2/legacy/modules/checkers/http.php
211c211,217< if ( defined( ‘WP_PROXY_USERNAME’ ) ) {if (! empty( $conf->options[‘proxy_un’] )) {
$auth = $conf->options[‘proxy_un’];
if (! empty( $conf->options[‘proxy_pw’])) {
$auth .= ‘:’ . $conf->options[‘proxy_pw’];
}
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, $auth );
} elseif ( defined( ‘WP_PROXY_USERNAME’ ) ) {Please let me know if you have any questions – I’ll be glad to pass them along to the person who made these recommendations.
Cheers,
Mark
- The topic ‘Setting a proxy user and password’ is closed to new replies.