Will this idea work if i just send out a HTTP HEAD reqest? instead of HTTP GET? I basically want to avoid loading the whole file just to check if squid cache has certain url in its cache. Thank you. On 7/12/07, Andreas Pettersson <andpet@xxxxxxxxx> wrote:
ying lcs wrote: > Thanks for all the help. > One more question (hopefully the last), > is it possible for me to link in the squidclient in my c/c++ program? > > I would like to do this "squidclient -H "Cache-Control: only-if-cached\n" > 'http://www.freebsd.org/' | head -1 | awk '{ if ($2=="200") print > "cached!"; else print "not cached"; }'" > > programically in my program. While it would be possible, you might want to use functions for speaking proxy http directly instead. If you can't find any it is quite simple to generate the whole query yourself; here's an example using netcat: echo "GET http://www.freebsd.org/ HTTP/1.0\nCache-Control: only-if-cached\n\n" | nc <proxyserver> <proxyport> | head -- Andreas