LSurl: Remove REQUESTED_URL parameter and always detecting URL from REQUEST_URI

This permit to correctly handle object's DN with slashes (with 
AllowEncodedSlashes NoDecode).
This commit is contained in:
Benjamin Renard 2020-06-25 16:00:20 +02:00
parent 0ce63f3d1e
commit 06852080a8
3 changed files with 7 additions and 19 deletions

View file

@ -8,3 +8,6 @@ Alias /ldapsaisie /usr/share/ldapsaisie/public_html
Options -Indexes +FollowSymLinks Options -Indexes +FollowSymLinks
AllowOverride FileInfo AllowOverride FileInfo
</Directory> </Directory>
# Uncomment if you have LDAP object DN with slashes
#AllowEncodedSlashes NoDecode

View file

@ -54,9 +54,6 @@ class LSurl extends LSlog_staticLoggerClass {
*/ */
private static $patterns = array(); private static $patterns = array();
// Rewrited request param
const REWRITED_REQUEST_PARAM = 'REQUESTED_URL';
/** /**
* Add an URL pattern * Add an URL pattern
* *
@ -161,18 +158,6 @@ class LSurl extends LSlog_staticLoggerClass {
return False; return False;
} }
/**
* Get the current requested URL
*
* @retval string The current requested URL
**/
public static function get_current_url() {
if (array_key_exists(self :: REWRITED_REQUEST_PARAM, $_REQUEST))
return $_REQUEST[self :: REWRITED_REQUEST_PARAM];
self :: log_warning('LSurl : Rewrite request param not present, try to detect current URL.');
return self :: detect_current_url();
}
/** /**
* Get the public absolute URL * Get the public absolute URL
* *
@ -283,15 +268,15 @@ class LSurl extends LSlog_staticLoggerClass {
} }
/** /**
* Helpers to detect current requested URL * Helpers to retreive current requested URL
*/ */
/* /*
* Try to detect current requested URL * Try to detect current requested URL and return it
* *
* @retval string|false The current request URL or false if detection fail * @retval string|false The current request URL or false if detection fail
**/ **/
private static function detect_current_url() { private static function get_current_url() {
self :: log_debug("URL : request URI = '".$_SERVER['REQUEST_URI']."'"); self :: log_debug("URL : request URI = '".$_SERVER['REQUEST_URI']."'");
$base = self :: get_rewrite_base(); $base = self :: get_rewrite_base();

View file

@ -1,2 +1,2 @@
RewriteEngine On RewriteEngine On
RewriteRule ^(.*)$ index.php?REQUESTED_URL=$1 [L,QSA] RewriteRule ^ index.php [L]