From kde-devel Mon Oct 29 01:52:13 2007 From: "Andres Riancho" Date: Mon, 29 Oct 2007 01:52:13 +0000 To: kde-devel Subject: Re: khtml and proxy configuration Message-Id: X-MARC-Message: https://marc.info/?l=kde-devel&m=119362278326318 List, I don't like to answer my own questions, but just for the archive i'm posting the solution I had to use to configure a proxy server: def configNeeded(self, protocol, host): #print "Sending user agent", self.configuration.userAgent(host) #print "Set Config Data" self.slaveConfig.setConfigData(protocol, host, "UserAgent", self.UserAgent) kconf = kdecore.KConfig("kioslaverc") kconf.setGroup("Proxy Settings") kconf.writeEntry("Enabled", "false") kconf.writeEntry("UseProxy", 'http://127.0.0.1:'+str(_proxyPort)+'/') kconf.writeEntry("ProxyType", '1') kconf.writeEntry("PersistentProxyConnection", '0') kconf.writeEntry("ReversedException", '0') kconf.writeEntry("NoProxyFor", '') kconf.writeEntry("Proxy", 'http://127.0.0.1:'+str(_proxyPort)+'/') kconf.writeEntry("httpProxy", 'http://127.0.0.1:'+str(_proxyPort)+'/') kconf.writeEntry("httpsProxy", 'http://127.0.0.1:'+str(_proxyPort)+'/') kconf.writeEntry("ProxyHost", '127.0.0.1') kconf.writeEntry("ProxyPort", str(_proxyPort) ) kconf.sync() On 10/26/07, Andres Riancho wrote: > List, > > I'm trying to embed khtml in python, and one of the things that I > want to do is to change the proxy server that khtml uses to connect to > the remote sites. Right now, I'm successfully catching the needConfig > signal and handling it this way: > > def configNeeded(self, protocol, host): > self.slaveConfig.setConfigData(protocol, host, "UserAgent", > self.UserAgent) > > #self.slaveConfig.setConfigData(protocol, host, "UseProxy", '1') > self.slaveConfig.setConfigData(protocol, host, "UseProxy", > 'http://127.0.0.1:8080/') > self.slaveConfig.setConfigData(protocol, host, "ProxyType", '1') > self.slaveConfig.setConfigData(protocol, host, > "PersistentProxyConnection", '0') > self.slaveConfig.setConfigData(protocol, host, "ReversedException", '0') > > self.slaveConfig.setConfigData(protocol, host, "NoProxyFor", '1.2.3.4') > > self.slaveConfig.setConfigData(protocol, host, "Proxy", > 'http://127.0.0.1:8080/') > self.slaveConfig.setConfigData(protocol, host, "httpProxy", > 'http://127.0.0.1:8080/') > self.slaveConfig.setConfigData(protocol, host, "httpsProxy", > 'http://127.0.0.1:8080/') > self.slaveConfig.setConfigData(protocol, host, "ProxyHost", '127.0.0.1') > self.slaveConfig.setConfigData(protocol, host, "ProxyPort", '8080') > > With this setConfigData calls, I'm able to set the user agent that > khtml uses; but the proxy configuration doesn't seem to apply. I have > read through the kprotocolmanager source code [0] and coudln't > understand what setConfigData calls I must make in order to instruct > khtml to ALWAYS use a specified HTTP proxy. > > Could you please help me and specify the variables(like UserAgent, > UseProxy,etc) I must set to make khtml use an HTTP proxy ? Is there > any good documentation for this ? > > [0] http://www.google.com/codesearch?hl=en&q=+khtml+UserAgent+UseProxy+show:4YigsnRr7Kc:Pc4znfTNJ6s:xzBvx8xA3VE&sa=N&cd=3&ct=rc&cs_p=http://security.debian.org/debian-security/pool/updates/main/k/kdelibs/kdelibs_3.3.2.orig.tar.gz&cs_f=kdelibs-3.3.2/kio/kio/kprotocolmanager.cpp > > Cheers, > > -- > Andres Riancho > http://w3af.sourceforge.net/ > Web Application Attack and Audit Framework > -- Andres Riancho http://w3af.sourceforge.net/ Web Application Attack and Audit Framework >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<