Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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
Пример #5
0
 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)
Пример #6
0
   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)
Пример #7
0
 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)
Пример #8
0
 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)
Пример #9
0
    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)
Пример #10
0
 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
Пример #11
0
    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)
Пример #12
0
    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)
Пример #13
0
 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)
Пример #14
0
 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)
Пример #15
0
 def __init__(self,
              resource,
              logPath=None,
              timeout=43200,
              supportedProtocols=None):
     Site.__init__(self, resource, logPath, timeout)
     self.handlers = {}
     self.supportedProtocols = supportedProtocols or []
Пример #16
0
 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
Пример #17
0
    def __init__(self, service):

        self._service = service

        root = self._InitRoot()

        Site.__init__(self, root)

        self.requestFactory = HydrusRequest
Пример #18
0
 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)
Пример #19
0
    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")
Пример #20
0
 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]
Пример #21
0
    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
Пример #22
0
    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")
Пример #23
0
    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
Пример #24
0
    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)
Пример #26
0
 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()
Пример #27
0
 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
Пример #28
0
    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")
Пример #29
0
    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()]))
Пример #30
0
    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()]))
Пример #31
0
    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)
Пример #32
0
    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)
Пример #33
0
    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)
Пример #34
0
    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
Пример #35
0
 def __init__(self, server, keys):
     Site.__init__(self, HTTPResource(server, keys))
Пример #36
0
 def __init__(self):
     Site.__init__(self, fi.web.protocol.WebProtocol(self))
Пример #37
0
 def __init__(self, resource, ip, timeout=60 * 60 * 1):
     self.ip = ip
     Site.__init__(self, resource, timeout=timeout)
Пример #38
0
 def __init__(self):
     Site.__init__(self, LoggerServerResource())
     Loggable.__init__(self)
Пример #39
0
 def __init__(self, *args, **kws):
     Site.__init__(self, *args, **kws)
     
     self._connections = weakref.WeakKeyDictionary()
     self._active = True
Пример #40
0
 def __init__(self, tempdir, *args, **kwargs):
     Site.__init__(self, *args, logFormatter=_logFormatter, **kwargs)
     self._tempdir = tempdir
Пример #41
0
 def __init__(self):
     Site.__init__(self, ClientListServerResource())
     Loggable.__init__(self)
Пример #42
0
 def __init__(self, *a, **kw):
     Site.__init__(self, *a, **kw)
     self.requestLengths = []
     self._activeRequests = set()
Пример #43
0
 def __init__(self, logPath=None, timeout=60*60*12):
     Site.__init__(self, logPath, timeout)
Пример #44
0
 def __init__(self, resource, logPath=None, timeout=60*60*12,
              supportedProtocols=None):
     Site.__init__(self, resource, logPath, timeout)
     self.handlers = {}
     self.supportedProtocols = supportedProtocols or []
Пример #45
0
 def __init__(self, resource):
     Site.__init__(self, resource, logPath='.')
Пример #46
0
	def __init__(self, overlay, rcr=None):
		Site.__init__(self, HTTPDTNWindServer())
		TCPWindFactory.__init__(self, overlay, rcr)
Пример #47
0
 def __init__(self):
     Site.__init__(self, MD5Root())
Пример #48
0
 def __init__(self, resource, ip, timeout=60 * 60 * 1):
     self.ip = ip
     Site.__init__(self, resource, timeout=timeout)
Пример #49
0
 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))
Пример #50
0
 def __init__(self, *a, **kw):
     Site.__init__(self, *a, **kw)
     self.requestLengths = []
     self._activeRequests = set()
Пример #51
0
 def __init__(self, db):
     Site.__init__(self, RestConsole(db))
Пример #52
0
 def __init__(self, chunkSize=CHUNK_SIZE):
     Site.__init__(self, JunkRoot(chunkSize))
Пример #53
0
 def __init__(self, keys):
     Site.__init__(self, AuthView(keys))
Пример #54
0
 def __init__(self, firewall, auth_server):
     Site.__init__(self, BouncerResource())
     Loggable.__init__(self)
     self.firewall = firewall
     self.auth_server = auth_server
Пример #55
0
 def __init__(self, resource, *args, **kwargs):
     Site.__init__(self, resource, *args, **kwargs)
     self.requestFactory = YuzukiRequest
     self.sessionFactory = YuzukiSession
Пример #56
0
 def __init__(self, *args, **kwargs):
     kwargs = self._filter_settings(kwargs)
 
     Site.__init__(self, self.root(), **kwargs)
Пример #57
0
 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()
Пример #58
0
 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))
Пример #59
0
 def __init__(self, resource, logPath=None, timeout=60):
     Site.__init__(self, resource, logPath=logPath, timeout=timeout)
     self.requestFactory = DelayRequest