couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject [42/50] couchdb commit: updated refs/heads/1.6.x to eeb31cb
Date Wed, 13 Aug 2014 23:26:30 GMT
Fauxton: Upgrade node-http-proxy

Some modifications have to be made because the API changed when
the module reached v1.0


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/08d25e97
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/08d25e97
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/08d25e97

Branch: refs/heads/1.6.x
Commit: 08d25e979bd64d0835a6a07c16e201d5749af498
Parents: af59351
Author: Michaƫl Zasso <mic.besace@gmail.com>
Authored: Wed Jul 2 13:42:23 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Wed Jul 2 16:31:46 2014 +0200

----------------------------------------------------------------------
 src/fauxton/Gruntfile.js         |  9 +--------
 src/fauxton/package.json         |  2 +-
 src/fauxton/tasks/couchserver.js | 16 +++++++++-------
 3 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/08d25e97/src/fauxton/Gruntfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js
index 8ffb2f8..047962e 100644
--- a/src/fauxton/Gruntfile.js
+++ b/src/fauxton/Gruntfile.js
@@ -124,14 +124,7 @@ module.exports = function(grunt) {
       dist: './dist/debug/',
       port: 8000,
       proxy: {
-        target: {
-          host: 'localhost',
-          port: 5984,
-          https: false
-        },
-        // This sets the Host header in the proxy so that you can use external
-        // CouchDB instances and not have the Host set to 'localhost'
-        changeOrigin: true
+        target: "http://localhost:5984/"
       }
     };
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/08d25e97/src/fauxton/package.json
----------------------------------------------------------------------
diff --git a/src/fauxton/package.json b/src/fauxton/package.json
index d84c881..a955892 100644
--- a/src/fauxton/package.json
+++ b/src/fauxton/package.json
@@ -27,7 +27,7 @@
     "underscore": "~1.4.2",
     "url": "~0.7.9",
     "urls": "~0.0.3",
-    "http-proxy": "~0.10.2",
+    "http-proxy": "~1.1.4",
     "send": "~0.1.1",
     "grunt-mocha-phantomjs": "~0.3.0"
   },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/08d25e97/src/fauxton/tasks/couchserver.js
----------------------------------------------------------------------
diff --git a/src/fauxton/tasks/couchserver.js b/src/fauxton/tasks/couchserver.js
index 8e95c5c..3e82e98 100644
--- a/src/fauxton/tasks/couchserver.js
+++ b/src/fauxton/tasks/couchserver.js
@@ -19,6 +19,7 @@ module.exports = function (grunt) {
         http = require("http"),
         httpProxy = require('http-proxy'),
         send = require('send'),
+        urlLib = require('url'),
         options = grunt.config('couchserver'),
         _ = grunt.util._;
 
@@ -30,18 +31,14 @@ module.exports = function (grunt) {
 
     // Proxy options with default localhost
     var proxy_settings = options.proxy || {
-      target: {
-        host: 'localhost',
-        port: 5984,
-        https: false
-      }
+      target: "http://localhost:5984/"
     };
 
     // inform grunt that this task is async
     var done = this.async();
 
     // create proxy to couch for all couch requests
-    var proxy = new httpProxy.HttpProxy(proxy_settings);
+    var proxy = httpProxy.createServer(proxy_settings);
 
     http.createServer(function (req, res) {
       var url = req.url.replace('app/',''),
@@ -97,7 +94,12 @@ module.exports = function (grunt) {
           .pipe(res);
       }
 
-      proxy.proxyRequest(req, res);
+      // This sets the Host header in the proxy so that one can use external
+      // CouchDB instances and not have the Host set to 'localhost'
+      var urlObj = urlLib.parse(req.url);
+      req.headers['host'] = urlObj.host;
+
+      proxy.web(req, res);
     }).listen(port);
 
     // Fail this task if any errors have been logged


Mime
View raw message