diff --git a/setup.py b/setup.py index 4fa0885..d3e73cd 100755 --- a/setup.py +++ b/setup.py @@ -26,13 +26,14 @@ import setuptools deps = [ 'certauth==1.1.6', 'warctools>=4.10.0', - 'urlcanon>=0.1.dev16', + 'urlcanon>=0.3.0', 'doublethink>=0.2.0.dev87', 'urllib3>=1.14', 'requests>=2.0.1', 'PySocks>=1.6.8', 'cryptography>=2.3', 'idna>=2.5', + 'PyYAML>=5.1', ] try: import concurrent.futures @@ -41,7 +42,7 @@ except: setuptools.setup( name='warcprox', - version='2.4b7.dev197', + version='2.4.0', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/tests/test_warcprox.py b/tests/test_warcprox.py index 7c6d21a..3c38d4e 100755 --- a/tests/test_warcprox.py +++ b/tests/test_warcprox.py @@ -965,12 +965,12 @@ def test_block_rules(http_daemon, https_daemon, warcprox_, archiving_proxies): }, { "url_match": "SURT_MATCH", - "value": "http://(localhost:%s,)/fuh/" % (http_daemon.server_port), + "value": "http://(localhost,:%s)/fuh/" % (http_daemon.server_port), }, { "url_match": "SURT_MATCH", # this rule won't match because of http scheme, https port - "value": "http://(localhost:%s,)/fuh/" % (https_daemon.server_port), + "value": "http://(localhost,:%s)/fuh/" % (https_daemon.server_port), }, { "domain": "bad.domain.com", diff --git a/warcprox/main.py b/warcprox/main.py index 7fe5011..0ef5c58 100644 --- a/warcprox/main.py +++ b/warcprox/main.py @@ -30,6 +30,7 @@ except ImportError: import Queue as queue import logging +import logging.config import sys import hashlib import argparse @@ -39,6 +40,7 @@ import traceback import signal import threading import certauth.certauth +import yaml import warcprox import doublethink import cryptography.hazmat.backends.openssl @@ -239,6 +241,9 @@ def _build_arg_parser(prog='warcprox', show_hidden=False): arg_parser.add_argument( '--trace', dest='trace', action='store_true', help='very verbose logging') + arg_parser.add_argument( + '--logging-conf-file', dest='logging_conf_file', default=None, + help=('reads logging configuration from a YAML file')) arg_parser.add_argument( '--version', action='version', version="warcprox {}".format(warcprox.__version__)) @@ -302,6 +307,11 @@ def main(argv=None): '%(asctime)s %(process)d %(levelname)s %(threadName)s ' '%(name)s.%(funcName)s(%(filename)s:%(lineno)d) %(message)s')) + if args.logging_conf_file: + with open(args.logging_conf_file, 'r') as fd: + conf = yaml.safe_load(fd) + logging.config.dictConfig(conf) + # see https://github.com/pyca/cryptography/issues/2911 cryptography.hazmat.backends.openssl.backend.activate_builtin_random()