couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [21/44] git commit: create constant for default max age value
Date Tue, 04 Dec 2012 20:43:49 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/0a4cd903
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0a4cd903
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0a4cd903

Branch: refs/heads/1368-fix-multipart-header-parts
Commit: 0a4cd90337b30c93a0506be918154d74645f16b5
Parents: 2709554
Author: Jan Lehnardt <jan@apache.org>
Authored: Thu Nov 8 22:34:31 2012 +0100
Committer: Jan Lehnardt <jan@apache.org>
Committed: Thu Nov 8 23:37:34 2012 +0100

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0a4cd903/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