[Inteproxy-commits] r32 - trunk
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Apr 5 14:55:39 CEST 2007
Author: bh
Date: 2007-04-05 14:55:39 +0200 (Thu, 05 Apr 2007)
New Revision: 32
Modified:
trunk/ChangeLog
trunk/InteProxy.py
Log:
* InteProxy.py (InteProxyHTTPRequestHandler.transfer_data.limit_length):
If debug level is less than two, limit the length of the debug
output with the actual data transferred. When all the data is
shown the other usually more interesting debug information is
easily overlooked.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-04-05 12:52:09 UTC (rev 31)
+++ trunk/ChangeLog 2007-04-05 12:55:39 UTC (rev 32)
@@ -1,5 +1,13 @@
2007-04-05 Bernhard Herzog <bh at intevation.de>
+ * InteProxy.py (InteProxyHTTPRequestHandler.transfer_data.limit_length):
+ If debug level is less than two, limit the length of the debug
+ output with the actual data transferred. When all the data is
+ shown the other usually more interesting debug information is
+ easily overlooked.
+
+2007-04-05 Bernhard Herzog <bh at intevation.de>
+
First step towards http proxy. InteProxy can be used as a http
proxy now as well (it still supports the old mode at the same
time). This implements part of feature request #349
Modified: trunk/InteProxy.py
===================================================================
--- trunk/InteProxy.py 2007-04-05 12:52:09 UTC (rev 31)
+++ trunk/InteProxy.py 2007-04-05 12:55:39 UTC (rev 32)
@@ -214,12 +214,21 @@
if self.debug_level > 0:
orig_read = read
orig_write = write
+
+ def limit_length(data):
+ """Returns a shortened version of the string data"""
+ if self.debug_level < 2 and len(data) > 13:
+ data = "%s ... %x bytes ... %s" % (data[:5],
+ len(data) - 10,
+ data[-5:])
+ return data
+
def read(length):
data = orig_read(length)
- self.log_debug("from server: %r", data)
+ self.log_debug("from server: %r", limit_length(data))
return data
def write(data):
- self.log_debug("to client: %r", data)
+ self.log_debug("to client: %r", limit_length(data))
orig_write(data)
# Now transfer the data in blocks of max_chunk_size
More information about the Inteproxy-commits
mailing list