r107857 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107856‎ | r107857 | r107858 >
Date:23:58, 2 January 2012
Author:tstarling
Status:resolved (Comments)
Tags:
Comment:
Match protocol-relative URLs. Patch by Anaconda.
Modified paths:
  • /trunk/extensions/SpamBlacklist/SpamBlacklist_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SpamBlacklist/SpamBlacklist_body.php
@@ -375,7 +375,7 @@
376376 //$regex = 'https?://+[a-z0-9_\-.]*(' . implode( '|', $lines ) . ')';
377377 //return '/' . str_replace( '/', '\/', preg_replace('|\\\*/|', '/', $regex) ) . '/Sim';
378378 $regexes = array();
379 - $regexStart = '/https?:\/\/+[a-z0-9_\-.]*(';
 379+ $regexStart = '/(?:https?:)?\/\/+[a-z0-9_\-.]*(';
380380 $regexEnd = ($batchSize > 0 ) ? ')/Sim' : ')/im';
381381 $build = false;
382382 foreach( $lines as $line ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r110401MFT r107857...reedy16:25, 31 January 2012
r110682Followup r107857, Bug 34179 - Unexpectedly blocks all protocols, not just htt...reedy20:14, 3 February 2012

Comments

#Comment by Umherirrender (talk | contribs)   20:45, 30 January 2012

It is possible to get this into 1.18wmf1? That fixed bug 33985 and makes it harder for the spammer. Thanks.

#Comment by Umherirrender (talk | contribs)   20:07, 3 February 2012

Thanks for the merge.

But please have a look at bug 34179, which is a directly result of this revision (and created now and not after 1.19 deployment due to the merge). Thanks.

#Comment by Reedy (talk | contribs)   20:09, 3 February 2012

If we don't make the whole http block optional, that will stop it catching other protocols

e.g.

$regexStart = '/(?:https?:)\/\/+[a-z0-9_\-.]*(';

Status & tagging log