[Calypso-commits] [calypso] 01/01: add custom headers via config file
Jelmer Vernooij
jelmer at moszumanska.debian.org
Sat Apr 9 22:49:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
jelmer pushed a commit to branch master
in repository calypso.
commit a0d6a16bdcf3a1baf10a6f4ccdf709a79c302d5b
Author: chrysn <chrysn at fsfe.org>
Date: Tue Apr 15 19:57:38 2014 +0200
add custom headers via config file
this is required when using calypso with a web application on a
different server
---
calypso/__init__.py | 3 +++
calypso/config.py | 6 +++++-
config | 11 +++++++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/calypso/__init__.py b/calypso/__init__.py
index 40987dd..da02962 100644
--- a/calypso/__init__.py
+++ b/calypso/__init__.py
@@ -172,6 +172,9 @@ class CollectionHTTPHandler(server.BaseHTTPRequestHandler):
self.send_response(response)
self.send_connection_header()
self.send_header("Content-Length", length)
+ for header, value in config.items('headers'):
+ self.send_header(header, value)
+
def handle_one_request(self):
"""Handle a single HTTP request.
diff --git a/calypso/config.py b/calypso/config.py
index 59cbd85..0c3fee9 100644
--- a/calypso/config.py
+++ b/calypso/config.py
@@ -60,7 +60,11 @@ INITIAL_CONFIG = {
"pam_service": "passwd",
},
"storage": {
- "folder": os.path.expanduser("~/.config/calypso/calendars")}}
+ "folder": os.path.expanduser("~/.config/calypso/calendars")
+ },
+ "headers": {
+ },
+}
# Create a ConfigParser and configure it
_CONFIG_PARSER = ConfigParser()
diff --git a/config b/config
index 1ef574c..7093716 100644
--- a/config
+++ b/config
@@ -51,4 +51,15 @@ encryption = crypt
# created if not present
folder = ~/.config/calypso/calendars
+# The headers section allows verbatim addition of static headers to
+# responses. The following exemplary headers are useful when the calendar
+# should be accessed from users' web browsers using a web application hosted on
+# a different server.
+#
+#[headers]
+#Access-Control-Allow-Origin = *
+#Access-Control-Allow-Credentials = *
+#Access-Control-Allow-Methods = GET, POST, PUT, DELETE, PROPFIND, REPORT
+#Access-Control-Allow-Headers = accept, authorization, content-type, depth, x-client, if-match
+
# vim:ft=cfg
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/calypso/calypso.git
More information about the Calypso-commits
mailing list