proxy settings

Duncan 1i5t5.duncan at cox.net
Sat Sep 10 00:50:58 BST 2011


Kevin Krammer posted on Fri, 09 Sep 2011 17:58:53 +0200 as excerpted:

> On Friday, 2011-09-09, Osvaldo Martin wrote:
>> Hi,
>> 
>> Googling kioslaverc I found that there is a command to read from that
>> file, in order to extract the http proxy settings I should use this
>> command:
>> 
>> "kreadconfig --file kioslaverc --group Proxy\ Settings --key httpproxy"
>> 
>> this will return the http host and the port, If the user is ussing and
>> authentication proxy conecction it will give also the username and
>> password?
> 
> I guess so.

@Osvaldo:  Please followup inline /under/ the part of the message you are
replying to, thus maintaining the context.  It makes further followups
/much/ easier. =:^)

As with Kevin, I don't authenticate to my (localhost-only, personal)
proxy, so can't confirm the username/password bit.  But, some more to
add...

"IMPORTANT*: That should be --key httpProxy (case sensitive, uppercase P
on proxy), or it returns nothing.  See below.

>> It this command available by default or require the installation some
>> extra package?
> 
> Yes, kreadconfig is part of all KDE installations.

FWIW, here on Gentoo, the kreadconfig binary is part of the kreadconfig
package, which is a dependency of the kdebase-startkde package.

What that means "in plain English" is that it will be installed as part of
the infrastructure for actually starting a kde session.  So anyone running
a kde session should have it installed (at least on Gentoo), but not
necessarily anyone simply running a kde app on some OTHER X session
(gnome, xfce, whatever), since it's not included in or a dependency of
kdelibs, a dependency on which is (by some practical definition at least)
what makes a kde app.

It's also worth noting that kde's config (as read by kreadconfig) is a
composition of data from several locations.  Normally, there will be at
least two config locations, one each in $KDEHOME and $KDEDIRS (with
appropriate defaults for each if they aren't set, often $HOME/.kde/ and
/usr/share/, but a distro may have other defaults), with the possibility
of config files in either or both locations.  It's thus possible for a
sysadmin to have a kioslaverc file at /usr/share/config/kioslaverc that
would contain settings for all users, that would be read first, so the
user settings (if present and if a value hasn't been set to prevent it)
override the system settings.

kreadconfig combines the data from all the files in all locations in the
appropriate stack-order, so the data read is the same as if a kde app was
reading it using (presumably) kdelibs functionality.  It's thus a MUCH
more appropriate way of reading the config, than to try to read it
directly from the config files yourself, even if it doesn't interpret what
it returns, that's upto the script/app calling it.

The caveat is that for kde apps installed alone, not with the
infrastructure necessary to run an entire kde session, kreadconfig might
not be available.

> However it only returns a value from a config file, it does not
> interpret the config.

Here's my user config kioslaverc here; no system kioslaverc (and the user
one is $HOME/kde/share/config/kioslaverc , no leading dot-dir, as I
dislike hidden major config dirs so set $KDEHOME appropriately, 
NoProxyFor and the httpProxy port slightly obfuscated)

-----------------8><------------------
AutoResume=true ConnectTimeout=20
PersistentProxyConnection=true
ProxyConnectTimeout=20
ReadTimeout=20
ResponseTimeout=40

[$Version]
update_info=kioslave.upd:kde2.2/r1,kioslave.upd:kde2.2/r3,kioslave.upd:kde2.2/r2

[Browser Settings/SMBro]
Encoding=iso 8859-1
Password=
ShowHiddenShares=false
User=
Workgroup=

[Proxy Settings]
AuthMode=0
MaxCacheSize=5120
NoProxyFor=aa,bb,cc,dd,192.168.aaa.bbb,aaa.com,www.sample.com,192.168.aaa.ccc
Proxy Config Script=
ProxyType=1
ReversedException=false
UseCache=false
cache=Reload
ftpProxy=
httpProxy=http://localhost:nnnn
httpsProxy=
-----------------><8------------------

Given that config ($>> indicates my shell prompt):

$>>kreadconfig --file kioslaverc --group "Proxy Settings" --key httpproxy     
                                                                                                                    
$>>kreadconfig --file kioslaverc --group "Proxy Settings" --key httpProxy                                          
http://localhost:nnnn
$>>


Note both the quoting of "Proxy Settings" so it is passed by the shell
as a single parameter, and that the whole thing is case sensitive
(httpproxy as the key returned nothing, neither would "proxy settings"
as the group, or KIOSlaverc, since in each case that refers to an
entirely different and here non-existing object).

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list