summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-11-25 08:21:33 -0800
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-11-25 08:21:33 -0800
commit4b67d4258d4b746673cc31c09c53f8822e2e6afc (patch)
tree2474bb9306ec27d12d2355e6093ce38134bb20ae /lib
parenta42d152ac344d287ee6e222f51c39d39d295fe92 (diff)
parentb9fed935b455d06ef943c562093c87171b71e4fc (diff)
downloadnextcloud-server-4b67d4258d4b746673cc31c09c53f8822e2e6afc.tar.gz
nextcloud-server-4b67d4258d4b746673cc31c09c53f8822e2e6afc.zip
Merge pull request #6035 from owncloud/fixing-rawpath-reverseproxy-oc6
Fixing rawpath reverseproxy oc6
Diffstat (limited to 'lib')
-rwxr-xr-xlib/private/request.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/private/request.php b/lib/private/request.php
index d11e5b16cfe..7a75bf25208 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -136,7 +136,18 @@ class OC_Request {
* @returns string Path info or false when not found
*/
public static function getRawPathInfo() {
- $path_info = substr($_SERVER['REQUEST_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ $requestUri = $_SERVER['REQUEST_URI'];
+ // remove too many leading slashes - can be caused by reverse proxy configuration
+ if (strpos($requestUri, '/') === 0) {
+ $requestUri = '/' . ltrim($requestUri, '/');
+ }
+
+ $scriptName = $_SERVER['SCRIPT_NAME'];
+ // in case uri and script name don't match we better throw an exception
+ if (strpos($requestUri, $scriptName) !== 0) {
+ throw new Exception("REQUEST_URI($requestUri) does not start with the SCRIPT_NAME($scriptName)");
+ }
+ $path_info = substr($requestUri, strlen($scriptName));
// Remove the query string from REQUEST_URI
if ($pos = strpos($path_info, '?')) {
$path_info = substr($path_info, 0, $pos);