[Inteproxy-commits] r132 - in trunk: . inteproxy
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jun 10 20:11:12 CEST 2008
Author: bh
Date: 2008-06-10 20:11:11 +0200 (Tue, 10 Jun 2008)
New Revision: 132
Modified:
trunk/ChangeLog
trunk/inteproxy/main.py
trunk/inteproxy/proxycore.py
Log:
Move the http openers from the request handler class to the server
instance.
* inteproxy/proxycore.py (MasterWorkerServer.__init__): New
arguments http11_opener and http10_opener that should be used to
open HTTP/1.1 and HTTP/1.0 connections
(InteProxyHTTPRequestHandler.handle_proxy_request): Use the
server's http11_opener and http10_opener instead of expecting the
openers as attributes of self or the class
* inteproxy/main.py (run_server): Pass the httpopener and
http10opener to the ServerClass instead of the setting them as
attributes of HandlerClass
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-05 17:32:27 UTC (rev 131)
+++ trunk/ChangeLog 2008-06-10 18:11:11 UTC (rev 132)
@@ -1,3 +1,19 @@
+2008-06-10 Bernhard Herzog <bh at intevation.de>
+
+ Move the http openers from the request handler class to the server
+ instance.
+
+ * inteproxy/proxycore.py (MasterWorkerServer.__init__): New
+ arguments http11_opener and http10_opener that should be used to
+ open HTTP/1.1 and HTTP/1.0 connections
+ (InteProxyHTTPRequestHandler.handle_proxy_request): Use the
+ server's http11_opener and http10_opener instead of expecting the
+ openers as attributes of self or the class
+
+ * inteproxy/main.py (run_server): Pass the httpopener and
+ http10opener to the ServerClass instead of the setting them as
+ attributes of HandlerClass
+
2008-06-02 Bernhard Herzog <bh at intevation.de>
* inteproxy/transcoder.py (TranscoderRequest.debug_log_request),
Modified: trunk/inteproxy/main.py
===================================================================
--- trunk/inteproxy/main.py 2008-06-05 17:32:27 UTC (rev 131)
+++ trunk/inteproxy/main.py 2008-06-10 18:11:11 UTC (rev 132)
@@ -164,15 +164,16 @@
setup_logging(opts)
https_proxy = eat_https_proxy_envvar()
- HandlerClass.httpopener = build_opener(https_proxy, opts.debug_level)
- HandlerClass.http10opener = build_opener(https_proxy, opts.debug_level, 10)
+ httpopener = build_opener(https_proxy, opts.debug_level)
+ http10opener = build_opener(https_proxy, opts.debug_level, 10)
server_address = ('localhost', opts.port)
sys.stderr.write("InteProxy Version %s\n" % inteproxy_version)
sys.stderr.write("[%s] server starting up\n" % log_date_time_string())
- httpd = ServerClass(server_address, HandlerClass, opts.workers)
+ httpd = ServerClass(server_address, HandlerClass, opts.workers,
+ httpopener, http10opener)
# import the gtkapp here instead of at top-level to avoid loading
# the gtk module. The gtk module requires an Xserver connection
Modified: trunk/inteproxy/proxycore.py
===================================================================
--- trunk/inteproxy/proxycore.py 2008-06-05 17:32:27 UTC (rev 131)
+++ trunk/inteproxy/proxycore.py 2008-06-10 18:11:11 UTC (rev 132)
@@ -45,10 +45,6 @@
#
debug_level = 0
- # urllib2.OpenDirector instances that we use to all
- httpopener = None
- http10opener = None
-
def do_SHUTDOWN(self):
"""Shutdown the server if self.allow_shutdown is True (default False).
@@ -148,9 +144,9 @@
# derived classes
if self.request_version == "HTTP/1.0":
self.log_debug("Trying http10opener.")
- response = self.http10opener.open(request)
+ response = self.server.http10_opener.open(request)
else:
- response = self.httpopener.open(request)
+ response = self.server.http11_opener.open(request)
except urllib2.HTTPError, err:
# a HTTPError is a valid http response object, so we can
@@ -294,8 +290,11 @@
do_shutdown = False
- def __init__(self, server_address, RequestHandlerClass, num_workers):
+ def __init__(self, server_address, RequestHandlerClass, num_workers,
+ http11_opener, http10_opener):
HTTPServer.__init__(self, server_address, RequestHandlerClass)
+ self.http11_opener = http11_opener
+ self.http10_opener = http10_opener
self.thread_pool = ThreadPool(num_workers, lambda f: f())
sys.stderr.write("[%s] starting %d worker threads\n" \
% (log_date_time_string(), num_workers))
More information about the Inteproxy-commits
mailing list