Skip to content
Permalink
Browse files

strip standard ports from HOST header in yourls_get_request()

* Modified yourls_get_request() to strip standard ports from HOST header
This adds support for HOST headers that always include port #s (even on standard ports 80/443 which will never appear in the YOURLS_SITE url).

* Adding a reference to the issue
So that it makes more sense when I read this in 10 years :)

Fixes #2611
  • Loading branch information
ksarnelli committed Mar 3, 2020
1 parent c43e923 commit 352b427b2f681d35062bbe91cf40c9f11f4b6526
Showing with 3 additions and 0 deletions.
  1. +3 −0 includes/functions.php
@@ -1976,6 +1976,9 @@ function yourls_get_request($yourls_site = false, $uri = false) {
}
if (false === $uri) {
$uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// Remove standard ports from $uri in case the HOST header is set to include them since they will never be in $yourls_site
// See #2613
$uri = str_replace( array( ':80', ':443'), '', $uri);
}

// Even though the config sample states YOURLS_SITE should be set without trailing slash...

0 comments on commit 352b427

Please sign in to comment.
You can’t perform that action at this time.