Here are the examples of the python api crossbar.twisted.site.createHSTSRequestFactory taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Source : router.py
with MIT License
from fbla-competitive-events
with MIT License
from fbla-competitive-events
def _create_web_factory(self, config):
options = config.get('options', {})
# create Twisted Web root resource
if '/' in config['paths']:
root_config = config['paths']['/']
root = self._create_resource(root_config, nested=False)
else:
root = Resource404(self._templates, b'')
# create Twisted Web resources on all non-root paths configured
self._add_paths(root, config.get('paths', {}))
# create the actual transport factory
transport_factory = Site(root)
transport_factory.noisy = False
# Web access logging
if not options.get('access_log', False):
transport_factory.log = lambda _: None
# Traceback rendering
transport_factory.displayTracebacks = options.get('display_tracebacks', False)
# HSTS
if options.get('hsts', False):
if 'tls' in config['endpoint']:
hsts_max_age = int(options.get('hsts_max_age', 31536000))
transport_factory.requestFactory = createHSTSRequestFactory(transport_factory.requestFactory, hsts_max_age)
else:
self.log.warn("Warning: HSTS requested, but running on non-TLS - skipping HSTS")
return transport_factory
def _add_paths(self, resource, paths):