r21542 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21541‎ | r21542 | r21543 >
Date:19:00, 24 April 2007
Author:aaron
Status:old
Tags:
Comment:
*Remove wfGetLastIPfromXFF() from r19889
Modified paths:
  • /trunk/phase3/includes/ProxyTools.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProxyTools.php
@@ -32,35 +32,6 @@
3333 }
3434
3535 /**
36 - * @todo FUCKING DOCUMENT THIS FUCKING FUNCTION
37 - */
38 -function wfGetLastIPfromXFF( $xff ) {
39 - if ( $xff ) {
40 - // Avoid annoyingly long xff hacks
41 - $xff = substr( $xff, 0, 255 );
42 - // Look for the last IP, assuming they are separated by commas or spaces
43 - $n = ( strrpos($xff, ',') ) ? strrpos($xff, ',') : strrpos($xff, ' ');
44 - if ( $n !== false ) {
45 - $last = trim( substr( $xff, $n + 1 ) );
46 - // Make sure it is an IP
47 - $m = preg_match('#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $last);
48 - $n = preg_match('#^:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7}$#', $last);
49 - if ( $m > 0 )
50 - $xff_ip = $last;
51 - else if ( $n > 0 )
52 - $xff_ip = $last;
53 - else
54 - $xff_ip = null;
55 - } else {
56 - $xff_ip = null;
57 - }
58 - } else {
59 - $xff_ip = null;
60 - }
61 - return $xff_ip;
62 -}
63 -
64 -/**
6536 * Returns the browser/OS data from the request header
6637 * Note: headers are spoofable
6738 * @return string

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r19889* Added useragent and an xff function and headeraaron01:02, 12 February 2007