Merge branch 'master' into travis-py37

* master:
  account for surt fix in urlcanon 0.3.0
  every change is a point release now
  Upgrade PyYAML to >=5.1
  Use YAML instead of JSON
  Add option to load logging conf from JSON file
This commit is contained in:
Noah Levitt 2019-03-21 13:48:58 -07:00
commit f2eebae641
3 changed files with 15 additions and 4 deletions

View File

@ -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',

View File

@ -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",

View File

@ -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()