def __init__(self, logger_name, config, resource, *args, **kwargs): Site.__init__(self, resource, *args, **kwargs) if config.captcha_ip_origin_is_x_forwarded: self._log_formatter = proxiedLogFormatter else: self._log_formatter = combinedLogFormatter self.access_logger = logging.getLogger(logger_name)
def __init__(self, core): thread_pool = ThreadPool() thread_pool.start() reactor.addSystemEventTrigger("after", "shutdown", thread_pool.stop) application = get_flask_application(core) wsgi_resource = WSGIResource(reactor, thread_pool, application) Site.__init__(self, wsgi_resource)
def __init__(self, uri, sites=None): with log.enter(obj=self) as tm: Site.__init__(self, None, timeout=60 * 60 * 30) self.uri = uri self.wsgi = None self.xmlrpc = None self._search_web_sites(sites)
def __init__(self, resource, logPath=None, displayTracebacks=None, **data): assert logPath is None _Site.__init__(self, resource, logPath=None, **data) if displayTracebacks is None: self.displayTracebacks = settings.DEBUG else: self.displayTracebacks = displayTracebacks
def __init__(self, uri, sites=None): with log.enter(obj=self) as tm: Site.__init__(self, None, timeout=60*60*30) self.uri = uri self.wsgi = None self.xmlrpc = None self._search_web_sites(sites)
def __init__(self): root = Resource() ## downloads server -- client grabs patch info from here root.putChild('u', VirtualFile('webRoot/downloads/u')) ## MOST OF THE BELOW DONT WORK SO ARE COMMENTED OUT ## redalert3pc.sake.gamespy.com sakeStorageServer = Resource() sakeStorageServer.putChild('StorageServer.asmx', StorageServer()) #root.putChild('SakeStorageServer', sakeStorageServer) ## redalert3pc.auth.pubsvs.gamespy.com -- used to auth before reporting results authService = Resource() authService.putChild('AuthService.asmx', AuthService()) #root.putChild('AuthService', authService) ## redalert3pc.comp.pubsvs.gamespy.com -- used to report match results compSvc = Resource() compSvc.putChild('competitionservice.asmx', CompetitionService()) #compSvc.putChild('CompetitionService.asmx', CompetitionService()) root.putChild('competitionservice', compSvc) #root.putChild('CompetitionService', compSvc) ## TODO: psweb.gamespy.com -- SOAP service that serves Clan-related requests ## TODO: redalert3services.gamespy.com -- HTTP GET requests that serve rank icons ## /GetPlayerRankIcon.aspx?gp=fgErop[sap9faZeJJELRac__&pid=<pid of player> retrieves that player's rank icon ## /GetPlayerLadderRatings.aspx?gp=fgErop[sap9faZeJJELRac__ retrieves CSV of ladder ratings Site.__init__(self, root)
def __init__(self, core): thread_pool = ThreadPool() thread_pool.start() reactor.addSystemEventTrigger('after', 'shutdown', thread_pool.stop) application = get_flask_application(core) wsgi_resource = WSGIResource(reactor, thread_pool, application) Site.__init__(self, wsgi_resource)
def __init__(self, resource, logPath=None, timeout=60 * 60 * 12, honor_xrealip=True): Site.__init__(self, resource, logPath=logPath, timeout=timeout) self.honor_xrealip = honor_xrealip
def __init__(self, logger_name, site_tag, config, resource, *args, **kwargs): Site.__init__(self, resource, *args, **kwargs) self.site_tag = site_tag proxied = config.get("x_forwarded", False) self.requestFactory = SynapseRequestFactory(self, proxied) self.access_logger = logging.getLogger(logger_name)
def __init__(self, *args, **kw): self.active_clients = 0 self.active_requests = set() self._max_requests = kw['max_requests'] del kw['max_requests'] self._request_count = 0 self._stopping_deferred = None Site.__init__(self, *args, **kw)
def __init__(self, *args, **kw): self.active_clients = 0 self.active_requests = list() self._max_requests = kw['max_requests'] del kw['max_requests'] self._request_count = 0 self._stopping_deferred = None Site.__init__(self, *args, **kw)
def __init__(self, resource, logPath=None, timeout=43200, supportedProtocols=None): Site.__init__(self, resource, logPath, timeout) self.handlers = {} self.supportedProtocols = supportedProtocols or []
def __init__(self, delay_site_resource, log_path=None, timeout=60 * 60 * 12): Site.__init__(self, delay_site_resource, logPath=log_path, timeout=timeout) self.requestFactory = DelayRequest
def __init__(self, service): self._service = service root = self._InitRoot() Site.__init__(self, root) self.requestFactory = HydrusRequest
def __init__(self, firewall): self.user = cattivo.config.get("cleaner", "user") self.passwd_file = cattivo.config.get("cleaner", "passwd-file") checker = FilePasswordDB(self.passwd_file) self.realm = CleanerRealm() self.portal = Portal(self.realm) self.portal.registerChecker(checker) self.firewall = firewall Site.__init__(self, CleanerResource(self.portal)) Loggable.__init__(self)
def __init__(self, logger_name, site_tag, config, resource, server_version_string, *args, **kwargs): Site.__init__(self, resource, *args, **kwargs) self.site_tag = site_tag proxied = config.get("x_forwarded", False) self.requestFactory = XForwardedForRequest if proxied else SynapseRequest self.access_logger = logging.getLogger(logger_name) self.server_version_string = server_version_string.encode("ascii")
def __init__(self, resource=None, *args, **kwargs): # type: (Resource, *Any, **Any) -> None """ :param resource: Root resource for Twisted's standard Site implementation. Pass a resource if you want to fall back to Twisted's default resource lookup mechanism in case no route matches. If None is passed, defaults to a NoResource() instance. """ resource = resource or NoResource() Site.__init__(self, resource, *args, **kwargs) self.routes = {} # type: Dict[Pattern, Resource]
def __init__(self, service_key, service_type, message): self._service_key = service_key self._service_type = service_type self._message = message root = self._InitRoot() Site.__init__(self, root) self.requestFactory = HydrusRequest
def __init__(self, logger_name, site_tag, config: ListenerConfig, resource, server_version_string, *args, **kwargs): Site.__init__(self, resource, *args, **kwargs) self.site_tag = site_tag assert config.http_options is not None proxied = config.http_options.x_forwarded self.requestFactory = XForwardedForRequest if proxied else SynapseRequest self.access_logger = logging.getLogger(logger_name) self.server_version_string = server_version_string.encode("ascii")
def __init__(self, service): self._service = service root = self._InitRoot() Site.__init__(self, root) if service.LogsRequests(): self.requestFactory = HydrusRequestLogging else: self.requestFactory = HydrusRequest
def __init__(self, resource, requestFactory=None, *args, **kwargs): preferences = zope.component.queryUtility( ICollectorPreferences, 'zenopenstack') self.request_buffer = HTTPDebugLogBuffer(preferences.options.httpdebugbuffersize) return TwistedSite.__init__(self, resource, requestFactory, *args, **kwargs)
def __init__(self, **kwargs): """ :todo: read config file or pass other settings for things like renderer settings. """ root = Resource() root.putChild('status', PrinterStatus()) root.putChild('static', File(static_path)) root.putChild('deform', File(pkg_resources.resource_filename("deform", "/static"))) root.putChild('renderer', FetchRendererForm()) root.putChild('', PrintDocument()) Site.__init__(self, root, **kwargs) self._connection = cups.Connection() self.renderers = self.loadRenderers()
def __init__( self, service ): self._service = service root = self._InitRoot() Site.__init__( self, root ) self.protocol = self._ProtocolFactory if service.LogsRequests(): self.requestFactory = HydrusServerRequest.HydrusRequestLogging else: self.requestFactory = HydrusServerRequest.HydrusRequest
def __init__( self, logger_name: str, site_tag: str, config: ListenerConfig, resource: IResource, server_version_string: str, max_request_body_size: int, reactor: IReactorTime, ): """ Args: logger_name: The name of the logger to use for access logs. site_tag: A tag to use for this site - mostly in access logs. config: Configuration for the HTTP listener corresponding to this site resource: The base of the resource tree to be used for serving requests on this site server_version_string: A string to present for the Server header max_request_body_size: Maximum request body length to allow before dropping the connection reactor: reactor to be used to manage connection timeouts """ Site.__init__(self, resource, reactor=reactor) self.site_tag = site_tag self.reactor = reactor assert config.http_options is not None proxied = config.http_options.x_forwarded request_class = XForwardedForRequest if proxied else SynapseRequest def request_factory(channel: HTTPChannel, queued: bool) -> Request: return request_class( channel, self, max_request_body_size=max_request_body_size, queued=queued, ) self.requestFactory = request_factory # type: ignore self.access_logger = logging.getLogger(logger_name) self.server_version_string = server_version_string.encode("ascii")
def __init__(self, master): self.authorized = {} index = IndexResource() robot = RobotResource() listjs = ListResource() status = StatusResource() pack = PackResource() packs = PacksTxtResource() index.factory = robot.factory = listjs.factory = status.factory = pack.factory = self self.master = index.master = robot.master = listjs.master = status.master = pack.master = packs.master = master Site.__init__(self, EncodingResourceWrapper(index, [GzipEncoderFactory()])) index.putChild("robots.txt", robot) # No reason to bother gzipping this index.putChild("list.js", EncodingResourceWrapper(listjs, [GzipEncoderFactory()])) index.putChild("status", EncodingResourceWrapper(status, [GzipEncoderFactory()])) index.putChild("pack", EncodingResourceWrapper(pack, [GzipEncoderFactory()])) index.putChild("packs.txt", EncodingResourceWrapper(packs, [GzipEncoderFactory()]))
def __init__(self, root_resource, *args, **kwargs): """ :param castiel_service: :param static_path: :param template_path: """ static_path = kwargs.pop('static_path', None) if static_path: root_resource.putChild('static', File(static_path)) template_path = kwargs.pop('template_path', None) if template_path: self.__jinja_loader = jinja2.FileSystemLoader(template_path) self.jinja_env = jinja2.Environment( extensions=['jinja2.ext.with_'], loader=self.__jinja_loader, ) Site.__init__(self, root_resource, *args, **kwargs)
def __init__(self): root = Resource() authService = Resource() authService.putChild('AuthService.asmx', AuthServiceImpl()) root.putChild('AuthService', authService) storageService = Resource() storageService.putChild('StorageServer.asmx', StorageServerImpl()) root.putChild('SakeStorageServer', storageService) competitionService = Resource() competitionService.putChild('CompetitionService.asmx', CompetitionServiceImpl()) root.putChild('CompetitionService', competitionService) motd_service = Resource() motd_service.putChild('motd.asp', BlankPage()) root.putChild('motd', motd_service) Site.__init__(self, root)
def __init__(self, resources_path, services, logLevel=logging.ERROR, gateway_path='gateway', debug=False): """ @type resources_path: C{str} @type services: C{dict} @type logLevel: C{int} @type gateway_path: C{str} @type debug: C{bool} """ # Map ActionScript classes to Python register_class(Question, namespace + '.Question') # remoting gateway gateway = TwistedGateway(services, expose_request=False, logger=logging, debug=debug) # static files root = File(resources_path) root.putChild(gateway_path, gateway) Site.__init__(self, root)
def __init__(self, service): self._service = service service_type = self._service.GetServiceType() self._server_version_string = HC.service_string_lookup[ service_type] + '/' + str(HC.NETWORK_VERSION) root = self._InitRoot() Site.__init__(self, root) self.protocol = self._ProtocolFactory if service.LogsRequests(): self.requestFactory = HydrusServerRequest.HydrusRequestLogging else: self.requestFactory = HydrusServerRequest.HydrusRequest
def __init__(self, server, keys): Site.__init__(self, HTTPResource(server, keys))
def __init__(self): Site.__init__(self, fi.web.protocol.WebProtocol(self))
def __init__(self, resource, ip, timeout=60 * 60 * 1): self.ip = ip Site.__init__(self, resource, timeout=timeout)
def __init__(self): Site.__init__(self, LoggerServerResource()) Loggable.__init__(self)
def __init__(self, *args, **kws): Site.__init__(self, *args, **kws) self._connections = weakref.WeakKeyDictionary() self._active = True
def __init__(self, tempdir, *args, **kwargs): Site.__init__(self, *args, logFormatter=_logFormatter, **kwargs) self._tempdir = tempdir
def __init__(self): Site.__init__(self, ClientListServerResource()) Loggable.__init__(self)
def __init__(self, *a, **kw): Site.__init__(self, *a, **kw) self.requestLengths = [] self._activeRequests = set()
def __init__(self, logPath=None, timeout=60*60*12): Site.__init__(self, logPath, timeout)
def __init__(self, resource, logPath=None, timeout=60*60*12, supportedProtocols=None): Site.__init__(self, resource, logPath, timeout) self.handlers = {} self.supportedProtocols = supportedProtocols or []
def __init__(self, resource): Site.__init__(self, resource, logPath='.')
def __init__(self, overlay, rcr=None): Site.__init__(self, HTTPDTNWindServer()) TCPWindFactory.__init__(self, overlay, rcr)
def __init__(self): Site.__init__(self, MD5Root())
def __init__(self, services, *a, **kw): services = flatten(services) for service in services: logger.info("Loading service: %s at %s" % (service, service.path)) Site.__init__(self, RESTResourceASCII(services, *a, **kw))
def __init__(self, db): Site.__init__(self, RestConsole(db))
def __init__(self, chunkSize=CHUNK_SIZE): Site.__init__(self, JunkRoot(chunkSize))
def __init__(self, keys): Site.__init__(self, AuthView(keys))
def __init__(self, firewall, auth_server): Site.__init__(self, BouncerResource()) Loggable.__init__(self) self.firewall = firewall self.auth_server = auth_server
def __init__(self, resource, *args, **kwargs): Site.__init__(self, resource, *args, **kwargs) self.requestFactory = YuzukiRequest self.sessionFactory = YuzukiSession
def __init__(self, *args, **kwargs): kwargs = self._filter_settings(kwargs) Site.__init__(self, self.root(), **kwargs)
def __init__(self, *a, **kw): self.endpointFunc = kw.pop('endpointFunc', None) Site.__init__(self, *a, **kw) self.endpointRequestLengths = collections.defaultdict(list) self.requestLengths = [] self._activeRequests = set()
def __init__(self, resource, logPath=None, timeout=60): Site.__init__(self, resource, logPath=logPath, timeout=timeout) self.requestFactory = DelayRequest