You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2009/10/02 17:35:53 UTC

svn commit: r821059 - /couchdb/trunk/src/couchdb/couch_httpd.erl

Author: jasondavies
Date: Fri Oct  2 15:35:53 2009
New Revision: 821059

URL: http://svn.apache.org/viewvc?rev=821059&view=rev
Log:
Add OAuth support for "https" URL scheme when using SSL proxy.

Modified:
    couchdb/trunk/src/couchdb/couch_httpd.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=821059&r1=821058&r2=821059&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Fri Oct  2 15:35:53 2009
@@ -273,7 +273,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).