mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
include/network:get_request_string() ignore fragments
This commit is contained in:
parent
470aa951e8
commit
eda4a2c116
1 changed files with 9 additions and 3 deletions
|
@ -1854,16 +1854,22 @@ function is_https_request() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Given a URL, return everything after the host portion.
|
||||
* @brief Given a URL, return everything after the host portion, but exclude any fragments.
|
||||
* example https://foobar.com/gravy?g=5&y=6
|
||||
* returns /gravy?g=5&y=6
|
||||
* example https:://foobar.com/gravy?g=5&y=6#fragment
|
||||
* also returns /gravy?g=5&y=6
|
||||
* result always returns the leading slash
|
||||
*/
|
||||
|
||||
function get_request_string($url) {
|
||||
|
||||
$a = explode('/',$url,4);
|
||||
return '/' . ((count($a) > 3) ? $a[3] : EMPTY_STR);
|
||||
$m = parse_url($url);
|
||||
if ($m) {
|
||||
return ( (isset($m['path']) ? $m['path'] : '/' ) . (isset($m['query']) ? '?' . $m['query'] : EMPTY_STR) );
|
||||
}
|
||||
|
||||
return EMPTY_STR;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue