[squid-users] Vary object loop returns

joe chip_pop at hotmail.com
Fri Jun 3 17:37:59 UTC 2016


i will just have to do patch i work direct on source if you want 
i post  and its not regx yet and the sbuf routine the dev guys shuld do it
its missing function str.erase in sbuf i gess
not good for production untill somone do regx match  on  -->    %20 filter
out

int
varyEvaluateMatch(StoreEntry * entry, HttpRequest * request)
{
    SBuf vary(request->vary_headers);
    int has_vary = entry->getReply()->header.has(HDR_VARY);
#if X_ACCELERATOR_VARY
    has_vary |=
        entry->getReply()->header.has(HDR_X_ACCELERATOR_VARY);
#endif


    if (!has_vary || entry->mem_obj->vary_headers.isEmpty()) {
        if (!vary.isEmpty()) {
            /* Oops... something odd is going on here.. */
            debugs(33, DBG_IMPORTANT, "varyEvaluateMatch: Oops. Not a Vary
object on second attempt, '" <<
                   entry->mem_obj->urlXXX() << "' '" << vary << "'");
            request->vary_headers.clear();
            return VARY_CANCEL;
        }

        if (!has_vary) {
            /* This is not a varying object */
            return VARY_NONE;
        }

        /* virtual "vary" object found. Calculate the vary key and
         * continue the search
         */
        vary = httpMakeVaryMark(request, entry->getReply());

        if (!vary.isEmpty()) {
            request->vary_headers = vary;
            return VARY_OTHER;
        } else {
            /* Ouch.. we cannot handle this kind of variance */
            /* XXX This cannot really happen, but just to be complete */
            return VARY_CANCEL;
        }
    } else {
        if (vary.isEmpty()) {
            vary = httpMakeVaryMark(request, entry->getReply());

            if (!vary.isEmpty())
                request->vary_headers = vary;
        }
if (!vary.isEmpty()) {
		std::string t = vary.c_str();

		std::string s = ",%20sdch";
		std::string::size_type i = t.find(s);
  if (i != std::string::npos){
     t.erase(i, s.length());
  }

		std::string s1 = ",%20deflate";
		std::string::size_type i1 = t.find(s1);

  if (i1 != std::string::npos){
     t.erase(i1, s1.length());
  }

		std::string s2 = ",%20gzip";
		std::string::size_type i2 = t.find(s2);

  if (i2 != std::string::npos){
     t.erase(i2, s2.length());
  }

		std::string s3 = ",%20identity";
		std::string::size_type i3 = t.find(s3);

  if (i3 != std::string::npos){
     t.erase(i3, s3.length());
  }
		vary=SBuf(t);
              return VARY_MATCH;
}
        if (vary.isEmpty()) {
            /* Ouch.. we cannot handle this kind of variance */
            /* XXX This cannot really happen, but just to be complete */
            return VARY_CANCEL;
        } else if (vary.cmp(entry->mem_obj->vary_headers) == 0) {
            return VARY_MATCH;
        } else {
            /* Oops.. we have already been here and still haven't
             * found the requested variant. Bail out
             */

            debugs(33, DBG_IMPORTANT, "varyEvaluateMatch: Oops. Not a Vary
match on second attempt, '" <<
                   entry->mem_obj->urlXXX() << "' '" << vary << "'");
            return VARY_CANCEL;
        }
    }
}



just replace the old function on client_side.cc  --> varyEvaluateMatch  with
the one i post  or i post later  the patch
dont lough im not pro but i do my home work



--
View this message in context: http://squid-web-proxy-cache.1019090.n4.nabble.com/Vary-object-loop-returns-tp4677716p4677792.html
Sent from the Squid - Users mailing list archive at Nabble.com.


More information about the squid-users mailing list