summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason David Davies <jasondavies@apache.org>2009-10-02 15:35:53 +0000
committerJason David Davies <jasondavies@apache.org>2009-10-02 15:35:53 +0000
commit7ccab9b164b008c32b4a35cd9524241c66069020 (patch)
tree8647873ec9bff26d9e4fb87aa32f61346e969b5e
parent6bcdf27022bd3992685a0188c3025aacfc35de5c (diff)
Add OAuth support for "https" URL scheme when using SSL proxy.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@821059 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/couchdb/couch_httpd.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index ac9ec723..b4e8793b 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -273,7 +273,18 @@ absolute_uri(#httpd{mochi_req=MochiReq}, Path) ->
end;
Value -> Value
end,
- "http://" ++ Host ++ Path.
+ XSsl = couch_config:get("httpd", "x_forwarded_ssl", "X-Forwarded-Ssl"),
+ Scheme = case MochiReq:get_header_value(XSsl) of
+ "on" -> "https";
+ _ ->
+ XProto = couch_config:get("httpd", "x_forwarded_proto", "X-Forwarded-Proto"),
+ case MochiReq:get_header_value(XProto) of
+ % Restrict to "https" and "http" schemes only
+ "https" -> "https";
+ _ -> "http"
+ end
+ end,
+ Scheme ++ "://" ++ Host ++ Path.
unquote(UrlEncodedString) ->
mochiweb_util:unquote(UrlEncodedString).