summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-10 23:51:57 -0800
committerEvan Prodromou <evan@status.net>2010-01-10 23:51:57 -0800
commite0eb51e4bb51f17b0281b7ec4e3d4eca33240978 (patch)
tree5c8b714f7cd31857a3c6ba5868c9a6169b5bf14a /lib/util.php
parentdd7195346c8fbf928ae7087fb7d342e62a4dce39 (diff)
add session ID to local URL when server parts differ
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php
index 7093d4e43..90d4a6532 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -820,6 +820,25 @@ function common_path($relative, $ssl=false)
}
}
+ if (common_have_session()) {
+
+ $currentServer = $_SERVER['HTTP_HOST'];
+
+ // Are we pointing to another server (like an SSL server?)
+
+ if (!empty($currentServer) &&
+ 0 != strcasecmp($currentServer, $serverpart)) {
+ // Pass the session ID as a GET parameter
+ $sesspart = session_name() . '=' . session_id();
+ $i = strpos($relative, '?');
+ if ($i === false) { // no GET params, just append
+ $relative .= '?' . $sesspart;
+ } else {
+ $relative = substr($relative, 0, $i + 1).$sesspart.'&'.substr($relative, $i + 1);
+ }
+ }
+ }
+
return $proto.'://'.$serverpart.'/'.$pathpart.$relative;
}