Re: [squid-users] how can I query squid cache?

From: Andreas Pettersson <andpet@dont-contact.us>
Date: Thu, 12 Jul 2007 09:14:14 +0200

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
Received on Thu Jul 12 2007 - 01:16:07 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:03 MDT