diff --git a/httprl.module b/httprl.module index 84ccd07..899bec5 100644 --- a/httprl.module +++ b/httprl.module @@ -211,6 +211,16 @@ function httprl_build_url_self($path = '', $detect_schema = FALSE) { } } + // Fix root_path. + // With dirname() if there are no slashes in the path, a dot is returned, + if ($root_path == '/./') { + $root_path = '/'; + } + // If ran from the command line SCRIPT_NAME contains the working directory. + elseif (!empty($_SERVER['PWD'])) { + $root_path = str_replace($_SERVER['PWD'] . '/', '', $root_path); + } + // Server auth. $auth = ''; if (isset($_SERVER['AUTH_TYPE']) && $_SERVER['AUTH_TYPE'] == 'Basic') {