From: Alex Rousskov Date: Mon, 24 Mar 2008 15:11:15 +0000 (-0600) Subject: Extract service URI scheme and store it as the service protocol. This will X-Git-Tag: SQUID_3_1_0_1~49^2~302^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=851efcb201674da00021238deb506f8bc17ad7e2;p=thirdparty%2Fsquid.git Extract service URI scheme and store it as the service protocol. This will allow us to distinguish between ICAP and eCAP services, at least in the begining of eCAP support. --- diff --git a/src/adaptation/Service.cc b/src/adaptation/Service.cc index f41ad14e48..c2dc19f7bc 100644 --- a/src/adaptation/Service.cc +++ b/src/adaptation/Service.cc @@ -74,13 +74,18 @@ Adaptation::Service::configure() debugs(3, 5, HERE << cfg_filename << ':' << config_lineno << ": " << "service is " << methodStr() << "_" << vectPointStr()); - if (false && uri.cmp("icap://", 7) != 0) { // XXX: parametrize and enable - debugs(3, 0, HERE << cfg_filename << ':' << config_lineno << ": " << - "wrong service URI protocol: " << uri.buf()); - return false; - } - - const char *s = uri.buf() + 7; + // TODO: find core code that parses URLs and extracts various parts + + // extract scheme and use it as the service protocol + const char *schemeSuffix = "://"; + if (const char *schemeEnd = uri.pos(schemeSuffix)) + protocol.limitInit(uri.buf(), schemeEnd - uri.buf()); + debugs(3, 5, HERE << cfg_filename << ':' << config_lineno << ": " << + "service protocol is " << protocol); + if (!protocol.size()) + return false; + + const char *s = uri.buf() + protocol.size() + sizeof(schemeSuffix); const char *e; diff --git a/src/adaptation/Service.h b/src/adaptation/Service.h index 8cd77dc73c..e21f9245c9 100644 --- a/src/adaptation/Service.h +++ b/src/adaptation/Service.h @@ -22,6 +22,7 @@ public: String uri; // service URI // service URI components + String protocol; String host; String resource; int port;