예제 #1
0
파일: server.py 프로젝트: redapple/splash
 def get_network_manager(request):
     manager = network_manager.FilteringQNetworkAccessManager(request)
     if cache_enabled:
         manager.setCache(cache.construct(cache_path, cache_size))
     if proxy_enabled:
         proxy_factory = proxy.SplashQNetworkProxyFactory(proxy_profiles_path, request)
         manager.setProxyFactory(proxy_factory)
     return manager
예제 #2
0
def _default_cache(cache_enabled, cache_path, cache_size):
    from twisted.python import log
    from splash import cache

    cache_enabled = defaults.CACHE_ENABLED if cache_enabled is None else cache_enabled
    cache_path = defaults.CACHE_PATH if cache_path is None else cache_path
    cache_size = defaults.CACHE_SIZE if cache_size is None else cache_size

    log.msg("cache_enabled=%s, cache_path=%r, cache_size=%sMB" % (cache_enabled, cache_path, cache_size))

    if cache_enabled:
        return cache.construct(cache_path, cache_size)
예제 #3
0
def _default_cache(cache_enabled, cache_path, cache_size):
    from twisted.python import log
    from splash import cache

    cache_enabled = defaults.CACHE_ENABLED if cache_enabled is None else cache_enabled
    cache_path = defaults.CACHE_PATH if cache_path is None else cache_path
    cache_size = defaults.CACHE_SIZE if cache_size is None else cache_size

    if cache_enabled:
        log.msg("cache_enabled=%s, cache_path=%r, cache_size=%sMB" % (cache_enabled, cache_path, cache_size))
        log.msg("[WARNING] You have enabled cache support. QT cache is known "
                "to cause segfaults and other issues for splash; "
                "enable it on your own risk. We recommend using a separate "
                "caching forward proxy like squid.")
        return cache.construct(cache_path, cache_size)