Page MenuHomePhabricator

Http::get within HttpFunction.php will not work with windows authentication.
Closed, InvalidPublic

Description

Author: mjbb81

Description:
The method Http::get, which is within includes/HttpFunction.php, will not work if you use windows authentication within IIS. We believe it is because Integrated Windows Authentication does not allow automated access to a URL via PHP. We noticed the error within the dump html extension: dumpHTML.inc in the method makeUrlSnapshot.

We created this method as a work around. It changes the url to a file using $IP. See the comments for restrictions to this method.

/**

  • Added to replace function 'makeUrlSnapshot( $url )'.
  • MakeUrlSnapshot will not work with IIS and windows anonymous access.
  • @param String $url - url of a file with $wgScriptPath as the prefix.
  • NOTE: It is important that url begins with $wgScriptPath. */ function copyUrlAsFile($url) { global $IP;

    $this->mkdir( "{$this->dest}/misc" ); $destName = urldecode( basename( $url ) ); $destPath = "{$this->dest}/misc/$destName"; if ( !file_exists( $destPath ) ) { Replace scriptPath with $IP. Make sure to replace only the prefix. $pattern ='/^'. str_replace("/","\\/",$this->oldScriptPath) . '/'; $newUrl = preg_replace($pattern,$IP,$url,1); copy($newUrl,$destPath); } return "{$this->articleBaseUrl}/misc/" . urlencode( $destName ); }

Version: 1.13.x
Severity: normal
OS: Windows XP

Details

Reference
bz22307

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:58 PM
bzimport set Reference to bz22307.
bzimport added a subscriber: Unknown Object (MLST).

(In reply to comment #0)

The method Http::get, which is within includes/HttpFunction.php, will not work
if you use windows authentication within IIS. We believe it is because
Integrated Windows Authentication does not allow automated access to a URL via
PHP.

I don't think that's the case. From looking at the code (the 1.15.1 stable HttpFunctions, and trunk) it wouldn't appear that we're passing any sort of authentication headers along with our request. It might be a good idea to do so, if we're requesting data from an HTTP-authenticated source.

Aklapper changed the task status from Open to Stalled.Aug 10 2020, 1:15 PM
Aklapper added a project: TestMe.
Aklapper subscribed.

In the meantime, code moved to https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/includes/http/Http.php#50 and that class is deprecated since 1.34. This task also lacks information which IIS version.

If anyone has time, can you please update to a recent supported version and tell us if this problem still happens?
If this still happens, please add a comment to this Phabricator task and tell us either your exact software version (for a MediaWiki installation, see the "Special:Version" page on your wiki) and the IIS version. Thanks.

Closing per last comment. Please reopen if this still happens in a supported version and provide version info.