} else {
$errors = $status->getErrorsByType( 'error' );
$logger = LoggerFactory::getInstance( 'http' );
- $logger->warning( $status->getWikiText(),
+ $logger->warning( $status->getWikiText( false, false, 'en' ),
[ 'error' => $errors, 'caller' => $caller, 'content' => $req->getContent() ] );
return false;
}
$uri
);
}
+
+ /**
+ * Gets the relevant proxy from $wgHTTPProxy/http_proxy (when set).
+ *
+ * @return mixed The proxy address or an empty string if not set.
+ */
+ public static function getProxy() {
+ global $wgHTTPProxy;
+
+ if ( $wgHTTPProxy ) {
+ return $wgHTTPProxy;
+ }
+
+ $envHttpProxy = getenv( "http_proxy" );
+ if ( $envHttpProxy ) {
+ return $envHttpProxy;
+ }
+
+ return "";
+ }
}
/**
* @return void
*/
public function proxySetup() {
- global $wgHTTPProxy;
-
// If there is an explicit proxy set and proxies are not disabled, then use it
if ( $this->proxy && !$this->noProxy ) {
return;
// local URL and proxies are not disabled
if ( Http::isLocalURL( $this->url ) || $this->noProxy ) {
$this->proxy = '';
- } elseif ( $wgHTTPProxy ) {
- $this->proxy = $wgHTTPProxy;
- } elseif ( getenv( "http_proxy" ) ) {
- $this->proxy = getenv( "http_proxy" );
+ } else {
+ $this->proxy = Http::getProxy();
}
}
];
if ( $this->proxy ) {
- $options['http']['proxy'] = $this->urlToTCP( $this->proxy );
+ $options['http']['proxy'] = $this->urlToTcp( $this->proxy );
$options['http']['request_fulluri'] = true;
}