tcllib - autoproxy problem...
From: Jeff Godfrey (jeff_godfrey_at_pobox.com)
Date: 01/09/05
- Next message: cfk: "interpreting a byte"
- Previous message: Khamis Abuelkomboz: "tk binding problem on gnome"
- Next in thread: Michael Schlenker: "Re: tcllib - autoproxy problem..."
- Reply: Michael Schlenker: "Re: tcllib - autoproxy problem..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 9 Jan 2005 14:15:07 -0600
Hi All,
I've just discovered the autoproxy module in tcllib (autoproxy 1.2.0).
Apparently, it's supposed to take a stab at figuring out your current proxy
settings for internet access, should you be using a proxy...
Anyway, for me it was failing miserably (under WinXP Pro) because of the
value being returned by the following line of code:
registry get $winregkey "ProxyServer"
the code following this call was expecting a return value of the format:
<server>:<port> (in my case --> quantex:8080)
but instead, my return value looks like this:
ftp=quantex:8080;gopher=quantex:8080;http=quantex:8080;https=quantex:8080
This is because in "Control Panel | Internet Options | Connections | LAN
Settings | Advanced", I *did not* have "Use the same proxy server for all
protocols" checked. Instead, each of protocols were filled out
independently. Since they were all filled out with the same info, just
checking the "Use the same proxy server..." option happened to be a quick
fix for me (as it formatted the registry key as expected by the autoproxy
module).
So, it seems that in the above case, the returned registry key needs some
further parsing. I've taken a stab at it below, but as I do very little
"internet programming", I'm not sure if I've made some "unsafe" assumptions.
Specifically:
1. Is it safe to parse this key (in the general case) using [split]?
2. Is the key always semi-colon separated?
3. Am I always after the "http" portion of the key?
The following sample code works for my specific case, but I'd like to get
the package patched. If someone closer to this than me can either validate
the below code (or suggest alternatives), I'll get a patch submitted.
#set reg(ProxyServer) [registry get $winregkey "ProxyServer"]
set reg(ProxyServer)
"ftp=quantex:8080;gopher=quantex:8080;http=quantex:8080;https=quantex:8080"
set serverInfo [split $reg(ProxyServer) ";"]
if {[llength $serverInfo] > 1} {
foreach record $serverInfo {
foreach {protocol info} [split $record "="] {
if {$protocol eq "http"} {
set reg(ProxyServer) $info
break
}
}
}
}
puts $reg(ProxyServer)
Thanks,
Jeff
- Next message: cfk: "interpreting a byte"
- Previous message: Khamis Abuelkomboz: "tk binding problem on gnome"
- Next in thread: Michael Schlenker: "Re: tcllib - autoproxy problem..."
- Reply: Michael Schlenker: "Re: tcllib - autoproxy problem..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|