Skip to content

Commit

Permalink
Make Protocols Lowercase Before Sending Request (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
R4356th committed Jun 5, 2021
1 parent 52828e1 commit 925f40d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,5 +1,8 @@
== ChangeLog for RottenLinks ==

=== 1.0.14 (05-06-2021) ===
* Make protocols lowercase before making request

=== 1.0.13 (13-05-2021) ===
* Use HttpRequestFactory

Expand Down
2 changes: 1 addition & 1 deletion extension.json
@@ -1,6 +1,6 @@
{
"name": "RottenLinks",
"version": "1.0.13",
"version": "1.0.14",
"author": [
"John Lewis"
],
Expand Down
10 changes: 8 additions & 2 deletions includes/RottenLinks.php
Expand Up @@ -7,9 +7,15 @@ public static function getResponse( $url ) {
$services = MediaWikiServices::getInstance();

$config = $services->getConfigFactory()->makeConfig( 'rottenlinks' );


// Make the protocol lowercase
$urlexp = explode( '://', $url);
$proto = strtolower( $urlexp[0] ) . '://';
$site = $urlexp[1];
$urlToUse = $proto . $site;

$request = $services->getHttpRequestFactory()->create(
$url, [
$urlToUse, [
'method' => 'HEAD', // return headers only
'timeout' => $config->get( 'RottenLinksCurlTimeout' ),
'userAgent' => 'RottenLinks, MediaWiki extension (https://github.com/miraheze/RottenLinks), running on ' . $config->get( 'Server' )
Expand Down

0 comments on commit 925f40d

Please sign in to comment.