couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasondav...@apache.org
Subject svn commit: r821071 - /couchdb/branches/0.10.x/src/couchdb/couch_httpd.erl
Date Fri, 02 Oct 2009 16:00:29 GMT
Author: jasondavies
Date: Fri Oct  2 16:00:28 2009
New Revision: 821071

URL: http://svn.apache.org/viewvc?rev=821071&view=rev
Log:
Merged fix from trunk: OAuth support for "https" URL scheme when using SSL proxy.

Modified:
    couchdb/branches/0.10.x/src/couchdb/couch_httpd.erl

Modified: couchdb/branches/0.10.x/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_httpd.erl?rev=821071&r1=821070&r2=821071&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_httpd.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_httpd.erl Fri Oct  2 16:00:28 2009
@@ -278,7 +278,18 @@
             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).



Mime
View raw message