mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
make it work with python 2.7 again
This commit is contained in:
parent
1e3dd0b910
commit
5f84b061f3
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
# vim: set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import warcprox.main
|
||||
|
||||
warcprox.main.main()
|
||||
|
1
setup.py
1
setup.py
@ -58,6 +58,7 @@ setuptools.setup(name='warcprox',
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Console',
|
||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Topic :: Internet :: Proxy Servers',
|
||||
'Topic :: Internet :: WWW/HTTP',
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim:set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
import os
|
||||
import OpenSSL
|
||||
@ -7,7 +9,7 @@ import socket
|
||||
import random
|
||||
|
||||
class CertificateAuthority(object):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.certauth.CertificateAuthority")
|
||||
|
||||
def __init__(self, ca_file='warcprox-ca.pem', certs_dir='./warcprox-ca'):
|
||||
self.ca_file = ca_file
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim: set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
import threading
|
||||
import signal
|
||||
@ -9,7 +11,7 @@ import warcprox.warcprox
|
||||
import warcprox.warcwriter
|
||||
|
||||
class WarcproxController(object):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.controller.WarcproxController")
|
||||
|
||||
def __init__(self, proxy=None, warc_writer_thread=None, playback_proxy=None):
|
||||
"""
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim:set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
try:
|
||||
import dbm.gnu as dbm_gnu
|
||||
except ImportError:
|
||||
@ -14,7 +16,7 @@ import json
|
||||
from hanzo import warctools
|
||||
|
||||
class DedupDb(object):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.dedup.DedupDb")
|
||||
|
||||
def __init__(self, dbm_file='./warcprox-dedup.db'):
|
||||
if os.path.exists(dbm_file):
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim:set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
try:
|
||||
import http.server as http_server
|
||||
except ImportError:
|
||||
@ -15,7 +17,7 @@ import logging
|
||||
import ssl
|
||||
|
||||
class MitmProxyHandler(http_server.BaseHTTPRequestHandler):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.mitmproxy.MitmProxyHandler")
|
||||
|
||||
def __init__(self, request, client_address, server):
|
||||
self.is_connect = False
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim:set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
try:
|
||||
import http.server as http_server
|
||||
except ImportError:
|
||||
@ -27,7 +29,7 @@ import re
|
||||
from warcprox.mitmproxy import MitmProxyHandler
|
||||
|
||||
class PlaybackProxyHandler(MitmProxyHandler):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.playback.PlaybackProxyHandler")
|
||||
|
||||
# @Override
|
||||
def _connect_to_host(self):
|
||||
@ -176,7 +178,7 @@ class PlaybackProxyHandler(MitmProxyHandler):
|
||||
|
||||
|
||||
class PlaybackProxy(socketserver.ThreadingMixIn, http_server.HTTPServer):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.playback.PlaybackProxy")
|
||||
|
||||
def __init__(self, server_address, req_handler_class=PlaybackProxyHandler,
|
||||
bind_and_activate=True, ca=None, playback_index_db=None,
|
||||
@ -196,7 +198,7 @@ class PlaybackProxy(socketserver.ThreadingMixIn, http_server.HTTPServer):
|
||||
|
||||
|
||||
class PlaybackIndexDb(object):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.playback.PlaybackIndexDb")
|
||||
|
||||
def __init__(self, dbm_file='./warcprox-playback-index.db'):
|
||||
if os.path.exists(dbm_file):
|
||||
|
@ -45,7 +45,7 @@ class ProxyingRecorder(object):
|
||||
calculating digests, and sending them on to the proxy client.
|
||||
"""
|
||||
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.warcprox.ProxyingRecorder")
|
||||
|
||||
def __init__(self, fp, proxy_dest, digest_algorithm='sha1'):
|
||||
self.fp = fp
|
||||
@ -149,13 +149,13 @@ class ProxyingRecordingHTTPResponse(http_client.HTTPResponse):
|
||||
|
||||
|
||||
class WarcProxyHandler(warcprox.mitmproxy.MitmProxyHandler):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.warcprox.WarcProxyHandler")
|
||||
|
||||
def _proxy_request(self):
|
||||
# Build request
|
||||
req_str = '{} {} {}\r\n'.format(self.command, self.path, self.request_version)
|
||||
|
||||
warcprox_meta = self.headers['Warcprox-Meta']
|
||||
warcprox_meta = self.headers.get('Warcprox-Meta')
|
||||
|
||||
# Swallow headers that don't make sense to forward on, i.e. most
|
||||
# hop-by-hop headers, see http://tools.ietf.org/html/rfc2616#section-13.5
|
||||
@ -237,7 +237,7 @@ class RecordedUrl(object):
|
||||
|
||||
|
||||
class WarcProxy(socketserver.ThreadingMixIn, http_server.HTTPServer):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.warcprox.WarcProxy")
|
||||
|
||||
def __init__(self, server_address=('localhost', 8000),
|
||||
req_handler_class=WarcProxyHandler, bind_and_activate=True,
|
||||
|
@ -1,5 +1,7 @@
|
||||
# vim:set sw=4 et:
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError:
|
||||
@ -18,7 +20,7 @@ from hanzo import warctools
|
||||
import warcprox
|
||||
|
||||
class WarcWriter:
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.warcwriter.WarcWriter")
|
||||
|
||||
# port is only used for warc filename
|
||||
def __init__(self, directory='./warcs', rollover_size=1000000000,
|
||||
@ -249,7 +251,7 @@ class WarcWriter:
|
||||
|
||||
|
||||
class WarcWriterThread(threading.Thread):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
logger = logging.getLogger("warcprox.warcwriter.WarcWriterThread")
|
||||
|
||||
def __init__(self, recorded_url_q=None, warc_writer=None, rollover_idle_time=None):
|
||||
"""recorded_url_q is a queue.Queue of warcprox.warcprox.RecordedUrl."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user