tcllib autoproxy and tcl 8.5.9 http package on windows vista with a
quid proxy server without authentication:
The following works well to fetch a file via our squid proxy server:
% package require http
% package require autoproxy
% ::autoproxy::init
% puts [::autoproxy::configure]
-authProc {} -basic {} -no_proxy {lilie lilie.naumburg.elmicron.de
naumburg.elmicron.de 192.168.200.147 <local>} -proxy_port 3128 -
proxy_host 192.168.200.147
% set hReq [http::geturl http://www.hibc.de/labelers.csv]
% puts [http::status $hReq]
ok
% puts [http::ncode $hReq]
200
% set Data [http::data $hReq]
...
% http::cleanup $hReq
---
Now I want to test manual setting of the parameter. I remove the proxy
parameters in Start->Control Pannel->Internet->Connections->LAN
Now the upper will fail (what is intended)
Now try it manually:
% package require http
% package require autoproxy
% ::autoproxy::init
% ::autoproxy::configure -host 192.168.200.147 -port 3128 -no_proxy
{lilie lilie.naumburg.elmicron.de naumburg.elmicron.de 192.168.200.147
<local>}
% puts [::autoproxy::configure]
-authProc {} -basic {} -no_proxy {lilie lilie.naumburg.elmicron.de
naumburg.elmicron.de 192.168.200.147 <local>} -proxy_port 3128 -
proxy_host 192.168.200.147
% set hReq [http::geturl http://www.hibc.de/labelers.csv]
% puts [http::status $hReq]
ok
% puts [http::ncode $hReq]
400
We get an "400 "bad request". But the "::autoproxy::configure" does
return the same data.
What is done in "autoproxy::init in plus, that makes it work with
automatic configuration ?
Thank you for any ideas,
Harald
What about trying the "black box" approach ?
Wireshark -> filter on tcp:3128 -> follow TCP stream in both cases ->
compare GETs in detail.
-Alex
O.k.: wireshark tcp.port == 3128
In the manual case, there are no packets send at all.
In the autoconfiguration case, there is a list of packets sent. The
get is as follows:
GET http://www.hibc.de/labelers.csv HTTP/1.1\r\n
and is sent to the proxy.
So remove the filter:
and the GET is requested like without a proxy and goes to
IP(www.hibc.de) Port 80.
So no proxy for this case.
So try without -no_proxy option -> same result.
Thank you,
Harald
Sorry I'm lost, dunno what exactly you are asking about. The wireshark
test showed you that the failing test was actually omitting the use
of a proxy ... so we learnt something, right ?
Now to proceed, I'd look at the -proxyfilter option of
http::configure, to see whether it was set properly in either case.
-Alex
The aim was to use a proxy. The case to not use the proxy was IMHO an
error.
The final destination was not covered by the "-no_proxy" expression,
but the proxy-server itself was.
To check if the -no_proxy option had any influence, I removed it for
test.
It had no influence. It should work with and without anyway.
----
http:config - very good, lets try:
1) With Proxy enabled in Windows Settings:
% package require http
2.7.5
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% package require autoproxy
1.5.1
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% ::autoproxy::init
http://192.168.200.147:3128
% puts [http::config]
-accept */* -proxyfilter ::autoproxy::filter -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% set hReq [http::geturl http://www.hibc.de/labelers.csv]
::http::1
% puts [http::config]
-accept */* -proxyfilter ::autoproxy::filter -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
9 % puts [http::status $hReq]
ok
% puts [http::ncode $hReq]
200
% http::cleanup $hReq
---
So the only visible item in the http::config is the -proxyfilter
setting.
2) With proxy disabled in windows settings and manual proxy setting:
% package require http
2.7.5
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% package require autoproxy
1.5.1
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% ::autoproxy::init
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% ::autoproxy::configure -host 192.168.200.147 -port 3128
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% set hReq [http::geturl http://www.hibc.de/labelers.csv]
::http::1
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% puts [http::status $hReq]
ok
% puts [http::ncode $hReq]
400
% http::cleanup $hReq
---
Obviously, the autoproxy module does not hook into the http package by
setting the -proxyfilter option.
Thus try to set this manually:
% package require http
2.7.5
% package require autoproxy
1.5.1
% ::autoproxy::init
% ::autoproxy::configure -host 192.168.200.147 -port 3128
% puts [http::config]
-accept */* -proxyfilter http::ProxyRequired -proxyhost {} -proxyport
{} -urlencoding utf-8 -useragent {Tcl http client package 2.7.5}
% http::config -proxyfilter ::autoproxy::filter
% set hReq [http::geturl http://www.hibc.de/labelers.csv]
::http::1
% puts [http::status $hReq]
ok
% puts [http::ncode $hReq]
200
% http::cleanup $hReq
... and it worked, thank you !
Lets try to find out why autoproxy does not hook into the http proxy
system.
- Remove autoproxy::init -> as it may disaple any proxy as there is
none in the system
-> does not help, configure does not set the http option.
I finally looked to the code. The only place were the hook is done is
when autiproxy::init wether got a proxy on command line or found one
in the system. As this is not the case in the code, it is never done.
I think it is time for:
- good friday afternoon tea
- file a bug report
- merci bien, Alexandre, de me pousser jusqu'au c'est finalement
trouvé.
Enjoy your day,
Harald