[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/master] Merge branch 'fix/15968-16649-csp-and-mobile' into develop
commit 343583dd3a15b36258bace06debe6f8d9d7bd9b7
Merge: 5e97d68 002104d
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date: Fri Jul 24 06:47:25 2015 +0000
Merge branch 'fix/15968-16649-csp-and-mobile' into develop
bridgedb.conf | 44 ++-
bridgedb/configure.py | 3 +-
bridgedb/https/server.py | 183 ++++++++++-
bridgedb/https/templates/assets/css/custom.css | 158 ---------
bridgedb/https/templates/assets/css/main.css | 419 +++++++++++++++++++++++-
bridgedb/https/templates/assets/css/rtl.css | 7 +
bridgedb/https/templates/assets/js/bridges.js | 83 +++++
bridgedb/https/templates/base.html | 142 ++++----
bridgedb/https/templates/bridges.html | 102 ++----
bridgedb/https/templates/captcha.html | 92 +++---
bridgedb/https/templates/howto.html | 11 +-
bridgedb/https/templates/index.html | 12 +-
bridgedb/https/templates/options.html | 124 ++++---
scripts/setup-tests | 1 +
setup.py | 3 +-
test/https_helpers.py | 32 +-
test/test_https.py | 22 ++
test/test_https_server.py | 130 +++++++-
18 files changed, 1105 insertions(+), 463 deletions(-)
diff --cc bridgedb/https/server.py
index 81ce09f,ef40377..2f5ed83
--- a/bridgedb/https/server.py
+++ b/bridgedb/https/server.py
@@@ -76,9 -73,39 +76,39 @@@ lookup = TemplateLookup(directories=[TE
collection_size=500)
logging.debug("Set template root to %s" % TEMPLATE_DIR)
+ #: This server's public, fully-qualified domain name.
+ SERVER_PUBLIC_FQDN = None
+
+
+ def setFQDN(fqdn, https=True):
+ """Set the global :data:`SERVER_PUBLIC FQDN` variable.
+
+ :param str fqdn: The public, fully-qualified domain name of the HTTP
+ server that will serve this resource.
+ :param bool https: If ``True``, then ``'https://'`` will be prepended to
+ the FQDN. This is primarily used to create a
+ ``Content-Security-Policy`` header that will only allow resources to
+ be sourced via HTTPS, otherwise, if ``False``, it allow resources to
+ be sourced via any transport protocol.
+ """
+ if https:
+ fqdn = 'https://' + fqdn
+
+ logging.info("Setting HTTP server public FQDN to %r" % fqdn)
+
+ global SERVER_PUBLIC_FQDN
+ SERVER_PUBLIC_FQDN = fqdn
+
+ def getFQDN():
+ """Get the setting for the HTTP server's public FQDN from the global
+ :data:`SERVER_PUBLIC_FQDN variable.
+
+ :rtype: str or None
+ """
+ return SERVER_PUBLIC_FQDN
def getClientIP(request, useForwardedHeader=False):
- """Get the client's IP address from the :header:`X-Forwarded-For`
+ """Get the client's IP address from the ``'X-Forwarded-For:'``
header, or from the :api:`request <twisted.web.server.Request>`.
:type request: :api:`twisted.web.http.Request`
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits