Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Disallow ports or non-http(s) schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
umbrae committed Aug 11, 2015
1 parent f8b1ea8 commit 42d43ee
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

if (!$url || !preg_match("/^https?:/i", $url)) {
echo '{ "result": "Invalid URL. Please check your URL and try again.", "error": true }';
return;
}

$parsed_url = parse_url($url);
$scheme = strtolower($parsed_url['scheme']);
if (array_key_exists('port', $parsed_url) || ($scheme !== "http" && $scheme !== "https")) {
echo '{ "result": "Invalid URL - Please check your URL and try again.", "error": true }';
return;
}

$ch = curl_init($url);
Expand Down

0 comments on commit 42d43ee

Please sign in to comment.