[Inteproxy-commits] r274 - in trunk: . inteproxy

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 20 21:37:08 CEST 2010


Author: bh
Date: 2010-09-20 21:37:07 +0200 (Mon, 20 Sep 2010)
New Revision: 274

Modified:
   trunk/ChangeLog
   trunk/inteproxy/proxyconnection.py
Log:
* inteproxy/proxyconnection.py (HTTPSProxyConnection): Removed.
Not used anymore.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-09-20 15:44:03 UTC (rev 273)
+++ trunk/ChangeLog	2010-09-20 19:37:07 UTC (rev 274)
@@ -1,5 +1,10 @@
 2010-09-20  Bernhard Herzog  <bh at intevation.de>
 
+	* inteproxy/proxyconnection.py (HTTPSProxyConnection): Removed.
+	Not used anymore.
+
+2010-09-20  Bernhard Herzog  <bh at intevation.de>
+
 	* inteproxy/transcoder.py
 	(OWSProxyPOSTTranscoder.wfs_root_elements): Add GetFeatureWithLock
 	operation

Modified: trunk/inteproxy/proxyconnection.py
===================================================================
--- trunk/inteproxy/proxyconnection.py	2010-09-20 15:44:03 UTC (rev 273)
+++ trunk/inteproxy/proxyconnection.py	2010-09-20 19:37:07 UTC (rev 274)
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, 2009 by Intevation GmbH
+# Copyright (C) 2008, 2009, 2010 by Intevation GmbH
 #
 # Based on code from
 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/456195 which
@@ -12,10 +12,7 @@
 the http CONNECT method (that can be used to proxy SSL connections).
 """
 
-import urlparse
 import urllib
-import httplib
-import socket
 
 
 default_ports = {'http' : 80, 'https' : 443}
@@ -39,52 +36,3 @@
     return host, port
 
 
-class HTTPSProxyConnection(httplib.HTTPConnection):
-
-    def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
-        if not skip_host:
-            raise ValueError("HTTPSProxyConnection.putrequest must be called"
-                             " with skip_host=True, because the correct Host"
-                             " request header field will not be generated"
-                             " automatically")
-
-        scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
-        if not netloc or not scheme:
-            raise ValueError("HTTPSProxyConnection.putrequest must be called"
-                             " with a full url including a scheme and a"
-                             " hostname.")
-
-        self._real_address = parse_netloc(scheme, netloc)
-
-        # Make sure the actual request url only contains the abspath
-        # part of the URL, and not the scheme and hostname.  HTTP/1.1
-        # servers are supposed to accept such URLs in requests, but
-        # clients should not send them.
-        url = urlparse.urlunsplit(("", "", path, query, fragment))
-
-        httplib.HTTPConnection.putrequest(self, method, url,
-                                          skip_host=skip_host,
-                                     skip_accept_encoding=skip_accept_encoding)
-
-    def connect(self):
-        httplib.HTTPConnection.connect(self)
-        self.send("CONNECT %s:%d HTTP/1.0\r\n\r\n" % self._real_address)
-        #expect a HTTP/1.0 200 Connection established
-        response = self.response_class(self.sock, strict=self.strict,
-                                       method=self._method)
-        (version, code, message) = response._read_status()
-        #probably here we can handle auth requests...
-        if code != 200:
-            #proxy returned and error, abort connection, and raise exception
-            self.close()
-            raise socket.error, ("Proxy connection failed: %d %s"
-                                 % (code, message.strip()))
-        #eat up header block from proxy....
-        while True:
-            #should not use directly fp probably
-            line = response.fp.readline()
-            if line == '\r\n':
-                break
-
-        ssl = socket.ssl(self.sock, None, None)
-        self.sock = httplib.FakeSocket(self.sock, ssl)



More information about the Inteproxy-commits mailing list