crossbar.common.twisted.web

Classes

Site

A web site: manage log, sessions, and resources.

_LessNoisyHTTPChannel

Internal helper.

Functions

createHSTSRequestFactory(requestFactory[, hstsMaxAge])

Builds a request factory that sets HSTS (HTTP Strict Transport

Module Contents

class Site(resource, client_timeout=None, access_log=None, display_tracebacks=None, hsts=None, hsts_max_age=None)[source]

Bases: twisted.web.server.Site

A web site: manage log, sessions, and resources.

@ivar requestFactory: A factory which is called with (channel)

and creates L{Request} instances. Default to L{Request}.

@ivar displayTracebacks: If set, unhandled exceptions raised during

rendering are returned to the client as HTML. Default to C{False}.

@ivar sessionFactory: factory for sessions objects. Default to L{Session}.

@ivar sessions: Mapping of session IDs to objects returned by

C{sessionFactory}.

@type sessions: L{dict} mapping L{bytes} to L{Session} given the default

C{sessionFactory}

@ivar counter: The number of sessions that have been generated. @type counter: L{int}

@ivar sessionCheckTime: Deprecated and unused. See

L{Session.sessionTimeout} instead.

displayTracebacks = True[source]
class _LessNoisyHTTPChannel[source]

Bases: twisted.web.http.HTTPChannel

Internal helper.

This is basically exactly what Twisted does, except without using “log.msg” so we can put it at debug log-level instead

log[source]
timeoutConnection()[source]

Called when the connection times out.

Override to define behavior other than dropping the connection.

createHSTSRequestFactory(requestFactory, hstsMaxAge=31536000)[source]

Builds a request factory that sets HSTS (HTTP Strict Transport Security) headers, by wrapping another request factory.