コード例 #1
0
ファイル: homeserver.py プロジェクト: payingattention/synapse
 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
ファイル: http.py プロジェクト: ojii/ircbotframework
 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
ファイル: site.py プロジェクト: TigerND/dtx-core
 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
ファイル: webServices.py プロジェクト: istobran/eaEmu
   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
ファイル: homeserver.py プロジェクト: yonglehou/synapse
 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
ファイル: webServices.py プロジェクト: zdmccune/eaEmu
    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
ファイル: site.py プロジェクト: 0-T-0/synapse
    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
ファイル: pastebin.py プロジェクト: david415/carml
 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
ファイル: http.py プロジェクト: alessandrod/cattivo
 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
ファイル: site.py プロジェクト: xorob0/synapse
    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
ファイル: HydrusServer.py プロジェクト: sttollgrin/hydrus
    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
ファイル: site.py プロジェクト: yvwvnacb/synapse
    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
ファイル: HydrusServer.py プロジェクト: Jade-Stern/hydrus
    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
ファイル: HydrusServer.py プロジェクト: Yoitsu/hydrus
 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
ファイル: txoffer.py プロジェクト: fullcounter/txoffer
    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
ファイル: site.py プロジェクト: MarsStirner/bouser
    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
ファイル: HydrusServer.py プロジェクト: pianomanx/hydrus
    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
ファイル: http.py プロジェクト: MazeXD/cuwo-webapi
 def __init__(self, server, keys):
     Site.__init__(self, HTTPResource(server, keys))
コード例 #36
0
ファイル: controller.py プロジェクト: benpence/freeInternet
 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
ファイル: server.py プロジェクト: alessandrod/cattivo
 def __init__(self):
     Site.__init__(self, LoggerServerResource())
     Loggable.__init__(self)
コード例 #39
0
ファイル: util.py プロジェクト: shuei/carchivetools
 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
ファイル: server.py プロジェクト: alessandrod/cattivo
 def __init__(self):
     Site.__init__(self, ClientListServerResource())
     Loggable.__init__(self)
コード例 #42
0
ファイル: polecat.py プロジェクト: taedixon/weasyl
 def __init__(self, *a, **kw):
     Site.__init__(self, *a, **kw)
     self.requestLengths = []
     self._activeRequests = set()
コード例 #43
0
ファイル: http.py プロジェクト: jvanveen/hwios-prototype
 def __init__(self, logPath=None, timeout=60*60*12):
     Site.__init__(self, logPath, timeout)
コード例 #44
0
ファイル: websocket.py プロジェクト: mdonoughe/rosbridge
 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
ファイル: utils.py プロジェクト: echeverrifm/op2-daemon
 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
ファイル: polecat.py プロジェクト: charmander/weasyl
 def __init__(self, *a, **kw):
     Site.__init__(self, *a, **kw)
     self.requestLengths = []
     self._activeRequests = set()
コード例 #51
0
ファイル: console.py プロジェクト: ioggstream/docker_dns
 def __init__(self, db):
     Site.__init__(self, RestConsole(db))
コード例 #52
0
ファイル: server.py プロジェクト: alexstaytuned/tx-pendrell
 def __init__(self, chunkSize=CHUNK_SIZE):
     Site.__init__(self, JunkRoot(chunkSize))
コード例 #53
0
ファイル: debug.py プロジェクト: aldryncore/djeese-fs
 def __init__(self, keys):
     Site.__init__(self, AuthView(keys))
コード例 #54
0
ファイル: http.py プロジェクト: alessandrod/cattivo
 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
ファイル: polecat.py プロジェクト: habnabit/polecat
 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
ファイル: request.py プロジェクト: chenrui/push
 def __init__(self, resource, logPath=None, timeout=60):
     Site.__init__(self, resource, logPath=logPath, timeout=timeout)
     self.requestFactory = DelayRequest