r42259 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42258‎ | r42259 | r42260 >
Date:08:12, 20 October 2008
Author:jojo
Status:old
Tags:
Comment:
applied patch by Richard Ash to allow mw-serve running with HTTPS and a self-signed certificate
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.php (modified) (history)
  • /trunk/extensions/Collection/README.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.php
@@ -43,6 +43,9 @@
4444 /** Login credentials to this MediaWiki as 'USERNAME:PASSWORD' string */
4545 $wgCollectionMWServeCredentials = null;
4646
 47+/** PEM-encoded SSL certificate for the mw-serve render server to pass to CURL */
 48+$wgCollectionMWServeCert = null;
 49+
4750 /** Namespace for "community collections" */
4851 $wgCommunityCollectionNamespace = NS_MEDIAWIKI;
4952
Index: trunk/extensions/Collection/README.txt
@@ -70,6 +70,11 @@
7171 Note that the MediaWiki must be accessible from the render server, i.e. if
7272 your MediaWiki is behind a firewall you cannot use the public render server.
7373
 74+ *$wgCollectionMWServeCert (string)*
 75+ Filename of a SSL certificate in PEM format for the mw-serve render server.
 76+ This needs to be used for self-signed certificates, otherwise CURL will
 77+ throw an error. The default is null, i.e. no certificate.
 78+
7479 *$wgCollectionMWServeCredentials (string)*
7580 Set this to a string of the form "USERNAME:PASSWORD" (or
7681 "USERNAME:PASSWORD:DOMAIN" if you're using LDAP), if the MediaWiki
Index: trunk/extensions/Collection/Collection.body.php
@@ -1312,7 +1312,8 @@
13131313 static function post( $url, $postFields, &$errorMessage, &$headers,
13141314 $timeout=true, $toFile=null ) {
13151315 global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
1316 -
 1316+ global $wgCollectionMWServeCert;
 1317+
13171318 $c = curl_init( $url );
13181319 curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
13191320 curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
@@ -1325,6 +1326,14 @@
13261327 if ( $timeout ) {
13271328 curl_setopt( $c, CURLOPT_TIMEOUT, $wgHTTPTimeout );
13281329 }
 1330+ /* Allow the use of self-signed certificates by referencing
 1331+ * a local (to the mediawiki install) copy of the signing
 1332+ * certificate */
 1333+ if ( !($wgCollectionMWServeCert === null) ) {
 1334+ curl_setopt ($c, CURLOPT_SSL_VERIFYPEER, TRUE);
 1335+ curl_setopt ($c, CURLOPT_CAINFO, $wgCollectionMWServeCert);
 1336+ }
 1337+
13291338 $headerStream = tmpfile();
13301339 curl_setopt( $c, CURLOPT_WRITEHEADER, $headerStream );
13311340 if ( $toFile ) {

Status & tagging log