Skip to content

Instantly share code, notes, and snippets.

@rnewson
Last active August 29, 2015 14:07
Show Gist options
  • Save rnewson/d51a0118908b7a175671 to your computer and use it in GitHub Desktop.
Save rnewson/d51a0118908b7a175671 to your computer and use it in GitHub Desktop.
db-level security for couchdb / couchdb-lucene
commit 73a15ab0cab9510d3649d6c0ca23f884139eb631
Author: Robert Newson <[email protected]>
Date: 2014-10-06 11:03:01 +0100
Support db-level proxy handling
diff --git a/src/couchdb/couch_httpd_proxy.erl b/src/couchdb/couch_httpd_proxy.erl
index dec3f55..fbfbf76 100644
--- a/src/couchdb/couch_httpd_proxy.erl
+++ b/src/couchdb/couch_httpd_proxy.erl
@@ -11,7 +11,7 @@
% the License.
-module(couch_httpd_proxy).
--export([handle_proxy_req/2]).
+-export([handle_proxy_req/2, handle_proxy_req/3]).
-include("couch_db.hrl").
-include("../ibrowse/ibrowse.hrl").
@@ -38,7 +38,11 @@ handle_proxy_req(Req, ProxyDest) ->
{error, Reason} ->
throw({error, Reason})
end.
-
+
+handle_proxy_req(Req, Db, ProxyDest) when is_binary(ProxyDest) ->
+ handle_proxy_req(Req, Db, ?b2l(ProxyDest));
+handle_proxy_req(Req, Db, ProxyDest) when is_list(ProxyDest) ->
+ handle_proxy_req(Req, ?l2b(ProxyDest ++ "/" ++ Db#db.name)).
get_method(#httpd{mochi_req=MochiReq}) ->
case MochiReq:get(method) of
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment