[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: khtml and proxy configuration
From:       "Andres Riancho" <andres.riancho () gmail ! com>
Date:       2007-10-29 1:52:13
Message-ID: cdfaf8b20710281852u1acbe004n9c153b339c1137e3 () mail ! gmail ! com
[Download RAW message or body]

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 <andres.riancho@gmail.com> 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:4YigsnRr \
> 7Kc:Pc4znfTNJ6s:xzBvx8xA3VE&sa=N&cd=3&ct=rc&cs_p=http://security.debian.org/debian-s \
> ecurity/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 <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic