]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Extract service URI scheme and store it as the service protocol. This will
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 24 Mar 2008 15:11:15 +0000 (09:11 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 24 Mar 2008 15:11:15 +0000 (09:11 -0600)
allow us to distinguish between ICAP and eCAP services, at least in the
begining of eCAP support.

src/adaptation/Service.cc
src/adaptation/Service.h

index f41ad14e48421ed14fba8a198f826a0bf86d9a1d..c2dc19f7bc356d6d2d8739d82a169c3e25d06f01 100644 (file)
@@ -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;
 
index 8cd77dc73cd870c692a779f09731928c393b9951..e21f9245c938a4e8a11599c02f370aaa2284144d 100644 (file)
@@ -22,6 +22,7 @@ public:
     String uri;    // service URI
 
     // service URI components
+    String protocol;
     String host;
     String resource;
     int port;