Code for IE-like web proxy detection

Dawit A. adawit at kde.org
Thu Feb 6 01:01:59 GMT 2003


On Monday 03 February 2003 18:33, juan at foxpaw.com wrote:

[snipped]

> > the current implementation under kdelibs/kio/misc/kpac.
>
> Yikes!  That's what I get for being out of date.  Nice job.  Confused on
> m_data in kpac_discovery.cpp, however--how is the domain name filled in? 
> Doesn't appear as if this code searches up domains unless gethostname()
> returns a FQDN, which it doesn't on my machine, anyway.

The way it works is simple. There is a helper C code called kpac_dhcp_helper.c 
which is a stand alone application. kpac_discovery.cpp simply uses the 
KProcess/KProcIO (kdelibs/kdecore/kprocess.*) to execute the standalone app 
and receive its output using the SIGNAL/SLOT mechanism.  It then processes 
the data it receives and extracts the URL. See the connect(...) calls in 
::tryDiscovery and ::slotDHCPData.

> Also, is it okay to block in these functions?  If so I can try to add SRV
> lookups.

I personally think you should avoid any extended blocks whenever possible. 
That is why there is that loop () hack to allow processing of other events. 
The sematics has changed in the current development version, uses a 
signal/slot (callbacks) scheme to avoid blocking. Anyways,  you might want to 
talk to Malte about that for more details since that is simply from a qucik 
observation by me.

> Is Malte still playing with this?

I believe he is.  He recently changed kpac to be a kded module in the current 
development version. I have CC'ed him just incase he is not subscribed to 
this mailing list.

Regards,
Dawit A.




More information about the kfm-devel mailing list