--------------------- PatchSet 3875 Date: 2006/10/25 04:56:34 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Whether a service wants a preview now depends on the HTTP request URL because ICAPOptions are now capable of honoring a Transfer-Preview header in an OPTIONS response. - Added wantsUrl() method to test whether the service wants to receive a given URL for adaptation. Some ICAP services return Transfer-Ignore header with an OPTIONS response, indicating that some URLs are not worth forwarding to the service. Members: src/ICAP/ICAPServiceRep.cc:1.1.2.5->1.1.2.6 src/ICAP/ICAPServiceRep.h:1.1.2.4->1.1.2.5 Index: squid3/src/ICAP/ICAPServiceRep.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPServiceRep.cc,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid3/src/ICAP/ICAPServiceRep.cc 18 Oct 2006 23:31:36 -0000 1.1.2.5 +++ squid3/src/ICAP/ICAPServiceRep.cc 25 Oct 2006 04:56:34 -0000 1.1.2.6 @@ -169,13 +169,22 @@ theOptions->valid() && theOptions->fresh(); } -bool ICAPServiceRep::wantsPreview(size_t &wantedSize) const +bool ICAPServiceRep::wantsUrl(const String &urlPath) const +{ + Must(up()); + return theOptions->transferKind(urlPath) != ICAPOptions::xferIgnore; +} + +bool ICAPServiceRep::wantsPreview(const String &urlPath, size_t &wantedSize) const { Must(up()); if (theOptions->preview < 0) return false; + if (theOptions->transferKind(urlPath) != ICAPOptions::xferPreview) + return false; + wantedSize = theOptions->preview; return true; @@ -321,17 +330,6 @@ if (skew > theOptions->ttl()) debugs(93, 1, host.buf() << "'s clock is skewed by " << skew << " seconds!"); - - List *tmp; - - for (tmp = theOptions->transfers.preview; tmp; tmp=tmp->next) - debugs(93,5,"Transfer-Preview: " << tmp->element.buf()); - - for (tmp = theOptions->transfers.ignore; tmp; tmp=tmp->next) - debugs(93,5,"Transfer-Ignore: " << tmp->element.buf()); - - for (tmp = theOptions->transfers.complete; tmp; tmp=tmp->next) - debugs(93,5,"Transfer-Complete: " << tmp->element.buf()); } static Index: squid3/src/ICAP/ICAPServiceRep.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPServiceRep.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- squid3/src/ICAP/ICAPServiceRep.h 6 Oct 2006 17:03:25 -0000 1.1.2.4 +++ squid3/src/ICAP/ICAPServiceRep.h 25 Oct 2006 04:56:34 -0000 1.1.2.5 @@ -1,6 +1,6 @@ /* - * $Id: ICAPServiceRep.h,v 1.1.2.4 2006/10/06 17:03:25 rousskov Exp $ + * $Id: ICAPServiceRep.h,v 1.1.2.5 2006/10/25 04:56:34 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -77,7 +77,8 @@ void callWhenReady(Callback *cb, void *data); // the methods below can only be called on an up() service - bool wantsPreview(size_t &wantedSize) const; + bool wantsUrl(const String &urlPath) const; + bool wantsPreview(const String &urlPath, size_t &wantedSize) const; bool allows204() const; public: