Proxy pass through
authorMichael Ang <mang@archive.org>
Wed, 29 Jun 2011 22:20:09 +0000 (22:20 +0000)
committerMichael Ang <mang@archive.org>
Wed, 29 Jun 2011 22:20:09 +0000 (22:20 +0000)
BookReaderIA/datanode/BookReaderJSIA.php
BookReaderIA/www/BookReaderAuth.php

index 8b7a4f9..d25ce92 100644 (file)
@@ -604,7 +604,6 @@ if (typeof(brConfig) != 'undefined') {
 
 
 function OLAuth() {
-    this.authUrl = br.olHost + '/ia_auth/' + br.bookId;
     this.olConnect = false;
     this.loanUUID = false;
     this.permsToken = false;
@@ -620,8 +619,15 @@ function OLAuth() {
         if (0 == cookies[i].indexOf('loan-' + br.bookId)) {
             this.permsToken = cookies[i].split('=')[1];
         }
+        
+        // Set olHost to use if passed in
+        if (0 == cookies[i].indexOf('ol-host')) {
+            br.olHost = 'http://' + unescape(cookies[i].split('=')[1]);
+        }
     }
 
+    this.authUrl = br.olHost + '/ia_auth/' + br.bookId;
+
     return this;
 }
 
index 04f25f7..e27833b 100644 (file)
@@ -22,6 +22,7 @@ $id = $_REQUEST['id'];
 $uuid = $_REQUEST['uuid'];
 $token = $_REQUEST['token'];
 $bookPath = $_REQUEST['bookPath'];
+$olHost = $_REQUEST['olHost'];
 
 if (!preg_match('/^\d{10}-[0-9a-f]{32}$/', $token)) {
     fatal();
@@ -42,6 +43,7 @@ if (!preg_match("|^/stream/$id|", $bookPath)) {
 
 setcookie('br-loan-' . $id, $uuid, 0, '/', '.archive.org');
 setcookie('loan-' . $id, $token, 0, '/', '.archive.org');
+setcookie('ol-host', $olHost, 0, '/', '.archive.org');
 
 header('Location: ' . $bookPath);