From 1ff6a767d001a8c0f45a190e26be363ea9410534 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 2 Aug 2011 16:52:47 +1200 Subject: Unit test++ --- libmproxy/proxy.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'libmproxy/proxy.py') diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 3ecd1f32..0c142959 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -284,11 +284,16 @@ class Request(HTTPMsg): modifications to make sure interception works properly. """ headers = self.headers.copy() - utils.try_del(headers, 'proxy-connection') - utils.try_del(headers, 'keep-alive') - utils.try_del(headers, 'connection') - utils.try_del(headers, 'content-length') - utils.try_del(headers, 'transfer-encoding') + utils.del_all( + headers, + [ + 'proxy-connection', + 'keep-alive', + 'connection', + 'content-length', + 'transfer-encoding' + ] + ) if not 'host' in headers: headers["host"] = [self.hostport()] content = self.content @@ -426,10 +431,10 @@ class Response(HTTPMsg): modifications to make sure interception works properly. """ headers = self.headers.copy() - utils.try_del(headers, 'proxy-connection') - utils.try_del(headers, 'connection') - utils.try_del(headers, 'keep-alive') - utils.try_del(headers, 'transfer-encoding') + utils.del_all( + headers, + ['proxy-connection', 'connection', 'keep-alive', 'transfer-encoding'] + ) content = self.content if content is not None: headers["content-length"] = [str(len(content))] -- cgit v1.2.3