r89812 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89811‎ | r89812 | r89813 >
Date:02:56, 10 June 2011
Author:demon
Status:ok (Comments)
Tags:
Comment:
MFT r89278, r89452. Also had to grab r83360.
Modified paths:
  • /branches/REL1_17/phase3/includes/HttpFunctions.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/HttpFunctions.php
@@ -116,16 +116,19 @@
117117 }
118118
119119 /**
120 - * Checks that the given URI is a valid one
 120+ * Checks that the given URI is a valid one. Hardcoding the
 121+ * protocols, because we only want protocols that both cURL
 122+ * and php support.
121123 *
 124+ * @fixme this is wildly inaccurate and fails to actually check most stuff
 125+ *
122126 * @param $uri Mixed: URI to check for validity
123127 * @returns Boolean
124128 */
125129 public static function isValidURI( $uri ) {
126130 return preg_match(
127 - '/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/',
128 - $uri,
129 - $matches
 131+ '/^https?:\/\/[^\/\s]\S*$/D',
 132+ $uri
130133 );
131134 }
132135 }
@@ -939,7 +942,8 @@
940943 // causes a segfault
941944 $manuallyRedirect = version_compare( phpversion(), '5.1.7', '<' );
942945
943 - if ( $this->parsedUrl['scheme'] != 'http' ) {
 946+ if ( $this->parsedUrl['scheme'] != 'http' &&
 947+ $this->parsedUrl['scheme'] != 'https' ) {
944948 $this->status->fatal( 'http-invalid-scheme', $this->parsedUrl['scheme'] );
945949 }
946950
Property changes on: branches/REL1_17/phase3/includes/HttpFunctions.php
___________________________________________________________________
Added: svn:mergeinfo
947951 Merged /branches/new-installer/phase3/includes/HttpFunctions.php:r43664-66004
948952 Merged /branches/wmf-deployment/includes/HttpFunctions.php:r53381
949953 Merged /branches/REL1_15/phase3/includes/HttpFunctions.php:r51646
950954 Merged /branches/sqlite/includes/HttpFunctions.php:r58211-58321
951955 Merged /trunk/phase3/includes/HttpFunctions.php:r82474,82845,82847-82848,83360,85752,89278,89452

Follow-up revisions

RevisionCommit summaryAuthorDate
r89813Followup r89812, RELEASE-NOTESdemon02:58, 10 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83360(bug 27854) Http::isValidURI is way to lax. This is a much simplified regex t...bawolff02:43, 6 March 2011
r89278Fix Bug #29231: PhpHttpRequest doesn't support HTTPS...mah18:57, 1 June 2011
r89452follow up r89278 — remove FTP support.mah02:59, 4 June 2011

Comments

#Comment by Krinkle (talk | contribs)   20:13, 26 June 2011

Looks like the first part of r89278 wasn't applied here, intentional ?

#Comment by 😂 (talk | contribs)   01:30, 27 June 2011

Do you mean the changes to HttpTest? Not necessary since the phpunit tests were dropped from REL1_17.

#Comment by Krinkle (talk | contribs)   04:33, 27 June 2011

Ah, okay that makes sense.

Status & tagging log