Esempio n. 1
0
    def run(self):
        print("WsgiDAVServerThread.run()...")
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        # config = DEFAULT_CONFIG.copy()
        # config.update({
        config = {
            "provider_mapping": {
                "/": provider
            },
            "user_mapping": {},
            "host": SERVER_HOST,
            "port": SERVER_PORT,
            "enable_loggers": [
                # "http_authenticator",
                # "lock_manager",
            ],
            "debug_methods": [],
            "property_manager": True,  # True: use lock_manager.LockManager
            "lock_manager": True,  # True: use lock_manager.LockManager
            # None: domain_controller.WsgiDAVDomainController(user_mapping)
            "domain_controller": None,
            "verbose": 4,
        }

        if withAuthentication:
            config["user_mapping"] = {
                "/": {
                    "tester": {
                        "password": "******",
                        "description": "",
                        "roles": []
                    },
                    "tester2": {
                        "password": "******",
                        "description": "",
                        "roles": []
                    },
                }
            }
            config["http_authenticator"] = {
                "accept_basic": True,
                "accept_digest": False,
                "default_to_digest": False,
            }

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]),
                                    {"": app})

        print("WsgiDAVServerThread ext_server.serve_forever_stoppable()...")
        self.ext_server.serve_forever_stoppable()
        print("WsgiDAVServerThread ext_server stopped.")
        self.ext_server = None
Esempio n. 2
0
    def run(self):
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        config = DEFAULT_CONFIG.copy()
        config.update({
            "provider_mapping": {
                "/": provider
            },
            "user_mapping": {},
            "host": "localhost",
            "port": 8080,
            "enable_loggers": [
                #                               "http_authenticator",
                #                               "lock_manager",
            ],
            "debug_methods": [],
            "propsmanager":
            True,  # True: use lock_manager.LockManager           
            "locksmanager":
            True,  # True: use lock_manager.LockManager                   
            "domaincontroller":
            None,  # None: domain_controller.WsgiDAVDomainController(user_mapping)
            "verbose": 2,
        })

        if withAuthentication:
            config["user_mapping"] = {
                "/": {
                    "tester": {
                        "password": "******",
                        "description": "",
                        "roles": [],
                    },
                    "tester2": {
                        "password": "******",
                        "description": "",
                        "roles": [],
                    },
                },
            }
            config["acceptbasic"] = True
            config["acceptdigest"] = False
            config["defaultdigest"] = False

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]),
                                    {"": app})

        self.ext_server.serve_forever_stoppable()
        self.ext_server = None