Merge branch 'master' of github.com:Kozea/radicale
This commit is contained in:
commit
ac687c6179
@ -6,10 +6,9 @@ python:
|
||||
- 3.5
|
||||
|
||||
install:
|
||||
- pip install -e .
|
||||
- pip install tox flake8
|
||||
- pip install tox
|
||||
|
||||
script:
|
||||
- tox -r -e py
|
||||
- tox -e py
|
||||
|
||||
sudo: false
|
||||
|
@ -33,6 +33,7 @@ import socket
|
||||
import ssl
|
||||
import wsgiref.simple_server
|
||||
import re
|
||||
import zlib
|
||||
from http import client
|
||||
from urllib.parse import unquote, urlparse
|
||||
|
||||
@ -314,6 +315,13 @@ class Application:
|
||||
if answer:
|
||||
self.logger.debug("Response content:\n%s" % answer, environ)
|
||||
answer = answer.encode(self.encoding)
|
||||
accept_encoding = [
|
||||
encoding.strip() for encoding in
|
||||
environ.get("HTTP_ACCEPT_ENCODING", "").split(",")
|
||||
if encoding.strip()]
|
||||
if "deflate" in accept_encoding:
|
||||
answer = zlib.compress(answer)
|
||||
headers["Content-Encoding"] = "deflate"
|
||||
headers["Content-Length"] = str(len(answer))
|
||||
|
||||
if self.configuration.has_section("headers"):
|
||||
|
@ -173,7 +173,7 @@ def run():
|
||||
if not configuration.getboolean("server", "dns_lookup"):
|
||||
RequestHandler.address_string = lambda self: self.client_address[0]
|
||||
|
||||
shutdown_program = [False]
|
||||
shutdown_program = False
|
||||
|
||||
for host in configuration.get("server", "hosts").split(","):
|
||||
address, port = host.strip().rsplit(":", 1)
|
||||
@ -198,11 +198,12 @@ def run():
|
||||
# SIGTERM and SIGINT (aka KeyboardInterrupt) should just mark this for
|
||||
# shutdown
|
||||
def shutdown(*args):
|
||||
if shutdown_program[0]:
|
||||
nonlocal shutdown_program
|
||||
if shutdown_program:
|
||||
# Ignore following signals
|
||||
return
|
||||
logger.info("Stopping Radicale")
|
||||
shutdown_program[0] = True
|
||||
shutdown_program = True
|
||||
if shutdown_program_socket_in:
|
||||
shutdown_program_socket_in.sendall(b"goodbye")
|
||||
signal.signal(signal.SIGTERM, shutdown)
|
||||
@ -218,7 +219,7 @@ def run():
|
||||
# Fallback to busy waiting
|
||||
select_timeout = 1.0
|
||||
logger.debug("Radicale server ready")
|
||||
while not shutdown_program[0]:
|
||||
while not shutdown_program:
|
||||
try:
|
||||
rlist, _, xlist = select.select(
|
||||
sockets, [], sockets, select_timeout)
|
||||
|
@ -97,7 +97,6 @@ def path_to_filesystem(root, *paths):
|
||||
Conversion is done in a secure manner, or raises ``ValueError``.
|
||||
|
||||
"""
|
||||
root = sanitize_path(root)
|
||||
paths = [sanitize_path(path).strip("/") for path in paths]
|
||||
safe_path = root
|
||||
for path in paths:
|
||||
@ -303,7 +302,7 @@ class Collection(BaseCollection):
|
||||
_, directories, _ = next(os.walk(collection._filesystem_path))
|
||||
for sub_path in directories:
|
||||
full_path = os.path.join(collection._filesystem_path, sub_path)
|
||||
if os.path.exists(path_to_filesystem(full_path)):
|
||||
if os.path.exists(full_path):
|
||||
yield cls(posixpath.join(path, sub_path))
|
||||
|
||||
@classmethod
|
||||
|
@ -133,6 +133,9 @@ def _comp_match(item, filter_, scope="collection"):
|
||||
for component in item.components():
|
||||
if component.name in ("VTODO", "VEVENT", "VJOURNAL"):
|
||||
tag = component.name
|
||||
break
|
||||
else:
|
||||
return False
|
||||
if filter_length == 0:
|
||||
# Point #1 of rfc4791-9.7.1
|
||||
return filter_.get("name") == tag
|
||||
|
Loading…
x
Reference in New Issue
Block a user