Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URL extension parsing #1602

Merged
merged 2 commits into from
Jul 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion advanced/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ function validIP($address){
}

// Retrieve server URI extension (EG: jpg, exe, php)
// strtok($uri, '\?') splits the querystring from the path (if there is a querystring)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this not working before because it wasn't actually setting a variable anywhere? If that's the case... 1/2

ini_set('pcre.recursion_limit',100);
$uriExt = pathinfo($uri, PATHINFO_EXTENSION);
$uriExt = pathinfo(strtok($uri,'\?'), PATHINFO_EXTENSION);

// Define which URL extensions get rendered as "Website Blocked"
$webExt = array('asp', 'htm', 'html', 'php', 'rss', 'xml');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2/2... does this fix now render this line unnecessary?

From my testing, I tried with http://adfoc.us/serve/sitelinks/?id=ANID&url=google.aspx (a valid URL extension not on the list!). Before I applied this change, I got the blank block page, and afterwards I got the full block page.

Seems to make sense to me, but @WaLLy3K may want to confirm as block page is his baby!

Copy link
Contributor

@WaLLy3K WaLLy3K Jul 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://adfoc.us/serve/sitelinks/?id=ANID&url=google.aspx is designed to be invalid, as anything with a ? query string is broadly determined to be a file, rather than attempting further detection.

That is to say, that's how I originally intended for it to be - I'm not 120% familiar with the current Block Page derivative as I am with my own.

Expand Down