couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [9/28] git commit: create constant for default max age value
Date Sun, 11 Nov 2012 19:24:31 GMT
create constant for default max age value


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

Branch: refs/heads/431-feature-cors
Commit: f0808ff9c416f92e8608aa5b80a7f8d674e211cc
Parents: d3564cf
Author: Jan Lehnardt <jan@apache.org>
Authored: Thu Nov 8 22:34:31 2012 +0100
Committer: Jan Lehnardt <jan@apache.org>
Committed: Sun Nov 11 16:11:15 2012 +0000

----------------------------------------------------------------------
 src/couchdb/couch_httpd_cors.erl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f0808ff9/src/couchdb/couch_httpd_cors.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_cors.erl b/src/couchdb/couch_httpd_cors.erl
index ad949ff..96abbe6 100644
--- a/src/couchdb/couch_httpd_cors.erl
+++ b/src/couchdb/couch_httpd_cors.erl
@@ -30,6 +30,10 @@
 -define(SUPPORTED_METHODS, "GET, HEAD, POST, PUT, DELETE," ++
         "TRACE, CONNECT, COPY, OPTIONS").
 
+% TODO: - pick a sane default
+%       - make configurable
+-define(CORS_DEFAULT_MAX_AGE, 12345).
+
 is_preflight_request(#httpd{method=Method}=Req) when Method /= 'OPTIONS' ->
     Req;
 is_preflight_request(Req) ->
@@ -122,7 +126,7 @@ handle_preflight_request(Origin, Host, MochiReq) ->
     SupportedHeaders = [string:to_lower(H) || H <- AllSupportedHeaders],
 
     % get max age
-    MaxAge = cors_config(Host, "max_age", "12345"),
+    MaxAge = cors_config(Host, "max_age", ?CORS_DEFAULT_MAX_AGE),
 
     PreflightHeaders0 = case credentials(Origin, Host) of
     true ->


Mime
View raw message