On Fri, Jan 29, 2010 at 5:22 PM,  <[email protected]> wrote:
> Author: jan
> Date: Sat Jan 30 01:22:36 2010
> New Revision: 904705
>
> URL: http://svn.apache.org/viewvc?rev=904705&view=rev
> Log:
> Allow Futon to run behind a HTTP proxy.

This change seems to make the Oauth test fail on Firefox (normal setup
no proxy).

I'm not sure why, maybe browsers impose different security rules on
paths that include ".."

Maybe changing the tests will be enough.

Chris

>
> Depending no the Proxy's RFC 2616 compliance,
> some tests might fail (looking at you, nginx).
>
> Patch by Jack Moffit and Damjan Georgievski.
>
> Closes COUCHDB-321.
>
> Modified:
>    couchdb/trunk/THANKS
>    couchdb/trunk/share/www/script/couch.js
>    couchdb/trunk/share/www/script/couch_tests.js
>    couchdb/trunk/share/www/script/futon.js
>    couchdb/trunk/share/www/script/jquery.couch.js
>
> Modified: couchdb/trunk/THANKS
> URL: 
> http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=904705&r1=904704&r2=904705&view=diff
> ==============================================================================
> --- couchdb/trunk/THANKS (original)
> +++ couchdb/trunk/THANKS Sat Jan 30 01:22:36 2010
> @@ -44,5 +44,7 @@
>  * Ilia Cheishvili <[email protected]>
>  * Lena Herrmann <[email protected]>
>  * Filipe Manana <[email protected]>
> + * Jack Moffit <[email protected]>
> + * Damjan Georgievski <[email protected]>
>
>  For a list of authors see the `AUTHORS` file.
>
> Modified: couchdb/trunk/share/www/script/couch.js
> URL: 
> http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch.js?rev=904705&r1=904704&r2=904705&view=diff
> ==============================================================================
> --- couchdb/trunk/share/www/script/couch.js [utf-8] (original)
> +++ couchdb/trunk/share/www/script/couch.js [utf-8] Sat Jan 30 01:22:36 2010
> @@ -321,6 +321,7 @@
>  // CouchDB.* functions (except for calls to request itself).
>  // Use this from callers to check HTTP status or header values of requests.
>  CouchDB.last_req = null;
> +CouchDB.urlPrefix = '';
>
>  CouchDB.login = function(name, password) {
>   CouchDB.last_req = CouchDB.request("POST", "/_session", {
> @@ -411,7 +412,7 @@
>  CouchDB.request = function(method, uri, options) {
>   options = options || {};
>   var req = CouchDB.newXhr();
> -  req.open(method, uri, false);
> +  req.open(method, CouchDB.urlPrefix + uri, false);
>   if (options.headers) {
>     var headers = options.headers;
>     for (var headerName in headers) {
>
> Modified: couchdb/trunk/share/www/script/couch_tests.js
> URL: 
> http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_tests.js?rev=904705&r1=904704&r2=904705&view=diff
> ==============================================================================
> --- couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
> +++ couchdb/trunk/share/www/script/couch_tests.js [utf-8] Sat Jan 30 01:22:36 
> 2010
> @@ -19,6 +19,7 @@
>   CouchDB.inBrowser = true;
>  }
>
> +CouchDB.urlPrefix = "..";
>  var couchTests = {};
>
>  function loadTest(file) {
>
> Modified: couchdb/trunk/share/www/script/futon.js
> URL: 
> http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.js?rev=904705&r1=904704&r2=904705&view=diff
> ==============================================================================
> --- couchdb/trunk/share/www/script/futon.js (original)
> +++ couchdb/trunk/share/www/script/futon.js Sat Jan 30 01:22:36 2010
> @@ -361,6 +361,7 @@
>
>   }
>
> +  $.couch.urlPrefix = "..";
>   $.futon = $.futon || {};
>   $.extend($.futon, {
>     navigation: new Navigation(),
>
> Modified: couchdb/trunk/share/www/script/jquery.couch.js
> URL: 
> http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/jquery.couch.js?rev=904705&r1=904704&r2=904705&view=diff
> ==============================================================================
> --- couchdb/trunk/share/www/script/jquery.couch.js [utf-8] (original)
> +++ couchdb/trunk/share/www/script/jquery.couch.js [utf-8] Sat Jan 30 
> 01:22:36 2010
> @@ -44,9 +44,10 @@
>   uuidCache = [];
>
>   $.extend($.couch, {
> +    urlPrefix: '',
>     activeTasks: function(options) {
>       ajax(
> -        {url: "/_active_tasks"},
> +        {url: this.urlPrefix + "/_active_tasks"},
>         options,
>         "Active task status could not be retrieved"
>       );
> @@ -54,14 +55,14 @@
>
>     allDbs: function(options) {
>       ajax(
> -        {url: "/_all_dbs"},
> +        {url: this.urlPrefix + "/_all_dbs"},
>         options,
>         "An error occurred retrieving the list of all databases"
>       );
>     },
>
>     config: function(options, section, option, value) {
> -      var req = {url: "/_config/"};
> +      var req = {url: this.urlPrefix + "/_config/"};
>       if (section) {
>         req.url += encodeURIComponent(section) + "/";
>         if (option) {
> @@ -85,7 +86,7 @@
>     session: function(options) {
>       options = options || {};
>       $.ajax({
> -        type: "GET", url: "/_session",
> +        type: "GET", url: this.urlPrefix + "/_session",
>         complete: function(req) {
>           var resp = $.httpData(req, "json");
>           if (req.status == 200) {
> @@ -120,7 +121,7 @@
>     login: function(options) {
>       options = options || {};
>       $.ajax({
> -        type: "POST", url: "/_session", dataType: "json",
> +        type: "POST", url: this.urlPrefix + "/_session", dataType: "json",
>         data: {name: options.name, password: options.password},
>         complete: function(req) {
>           var resp = $.httpData(req, "json");
> @@ -137,7 +138,7 @@
>     logout: function(options) {
>       options = options || {};
>       $.ajax({
> -        type: "DELETE", url: "/_session", dataType: "json",
> +        type: "DELETE", url: this.urlPrefix + "/_session", dataType: "json",
>         username : "_", password : "_",
>         complete: function(req) {
>           var resp = $.httpData(req, "json");
> @@ -155,7 +156,7 @@
>     db: function(name) {
>       return {
>         name: name,
> -        uri: "/" + encodeURIComponent(name) + "/",
> +        uri: this.urlPrefix + "/" + encodeURIComponent(name) + "/",
>
>         compact: function(options) {
>           $.extend(options, {successStatus: 202});
> @@ -377,7 +378,7 @@
>
>     info: function(options) {
>       ajax(
> -        {url: "/"},
> +        {url: this.urlPrefix + "/"},
>         options,
>         "Server information could not be retrieved"
>       );
> @@ -385,7 +386,7 @@
>
>     replicate: function(source, target, options) {
>       ajax({
> -          type: "POST", url: "/_replicate",
> +          type: "POST", url: this.urlPrefix + "/_replicate",
>           data: JSON.stringify({source: source, target: target}),
>           contentType: "application/json"
>         },
> @@ -399,7 +400,7 @@
>         cacheNum = 1;
>       }
>       if (!uuidCache.length) {
> -        ajax({url: "/_uuids", data: {count: cacheNum}, async: false}, {
> +        ajax({url: this.urlPrefix + "/_uuids", data: {count: cacheNum}, 
> async: false}, {
>             success: function(resp) {
>               uuidCache = resp.uuids
>             }
>
>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Reply via email to