[Phonehome-commits] r82 - branches/ssl-proxy-test/frontend/src
pamadio at garage.maemo.org
pamadio at garage.maemo.org
Sun Oct 19 17:13:41 EEST 2008
Author: pamadio
Date: 2008-10-19 17:13:41 +0300 (Sun, 19 Oct 2008)
New Revision: 82
Modified:
branches/ssl-proxy-test/frontend/src/phonehome-gui
Log:
does not work
Modified: branches/ssl-proxy-test/frontend/src/phonehome-gui
===================================================================
--- branches/ssl-proxy-test/frontend/src/phonehome-gui 2008-10-19 14:12:07 UTC (rev 81)
+++ branches/ssl-proxy-test/frontend/src/phonehome-gui 2008-10-19 14:13:41 UTC (rev 82)
@@ -28,17 +28,30 @@
import conic
import dbus
import httplib
+import re
_ = gettext.gettext
class ProxiedTransport(xmlrpclib.Transport):
+ def __init__(self,https=False):
+ self.https=https
+ print "ProxiedTransport with https:",self.https
+
def set_proxy(self, proxy):
self.proxy = proxy
def make_connection(self, host):
self.realhost = host
- h = httplib.HTTP(self.proxy)
+ if self.https:
+ h = httplib.HTTP(self.proxy)
+ else:
+ h = httplib.HTTPS(self.proxy)
return h
+
def send_request(self, connection, handler, request_body):
- connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
+ if self.https:
+ connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
+ else:
+ connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
+
def send_host(self, connection, host):
connection.putheader('Host', self.realhost)
@@ -128,15 +141,24 @@
id=self.tid_entry.get_text()
passw=self.password_entry.get_text()
server_url=self.server_entry.get_text()
- print id,passw,server_url
+ print "id=%s,passw=%s,server_url=%s"%(id,passw,server_url)
print "proxy_mode=",self.proxy_mode
if self.proxy_mode==conic.PROXY_MODE_NONE:
server=xmlrpclib.ServerProxy(server_url)
elif self.proxy_mode==conic.PROXY_MODE_MANUAL:
- p = ProxiedTransport()
- p.set_proxy("%s:%s"%(self.http_proxy,self.http_proxy_port))
+ print "manual proxy"
+
+
+ if(re.compile("^https").search(server_url)):
+ p = ProxiedTransport(https=True)
+ p.set_proxy("%s:%s"%(self.https_proxy,self.https_proxy_port))
+ print "connection threw %s:%s"%(self.https_proxy,self.https_proxy_port)
+ else:
+ p = ProxiedTransport(https=False)
+ p.set_proxy("%s:%s"%(self.http_proxy,self.http_proxy_port))
+ print "connection threw %s:%s"%(self.http_proxy,self.http_proxy_port)
server=xmlrpclib.ServerProxy(server_url,transport=p)
else:
sysnote.system_note_infoprint(_("Automatic proxy mode not supported"))
@@ -171,8 +193,10 @@
self.http_proxy_port=0
self.https_proxy=0
- print "proxy=",self.http_proxy
- print "port=",self.http_proxy_port
+ print "http_proxy=",self.http_proxy
+ print "http_port=",self.http_proxy_port
+ print "https_proxy=",self.https_proxy
+ print "https_port=",self.https_proxy_port
"""
locale.setlocale(locale.LC_ALL, "fr_FR")
os.environ["LANGUAGE"]="fr_FR"
More information about the Phonehome-commits
mailing list