]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Audit result changes
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 11 Nov 2012 05:10:59 +0000 (18:10 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 11 Nov 2012 05:10:59 +0000 (18:10 +1300)
src/HelperReply.cc
src/MemBuf.cc
src/MemBuf.h
src/cf.data.pre

index 08314f8a810cad24a881c5d95ad501b4f9f1e886..d12499a2e0a879060e6b220e5b66c4c3c5864cab 100644 (file)
@@ -124,10 +124,15 @@ HelperReply::parseResponseKeys()
         if (*p != '=')
             return; // done. Not a key.
 
+        // whitespace between key and value is prohibited.
+        // workaround strwordtok() which skips whitespace prefix.
+        if (xisspace(*(p+1)))
+            return; // done. Not a key.
+
         *p = '\0';
         ++p;
 
-        String key(other().content());
+        const String key(other().content());
 
         // the value may be a quoted string or a token
         const bool urlDecode = (*p != '"'); // check before moving p.
@@ -139,7 +144,7 @@ HelperReply::parseResponseKeys()
         responseKeys.add(key, value);
 
         modifiableOther().consume(p - other().content());
-        modifiableOther().consumeWhitespace();
+        modifiableOther().consumeWhitespacePrefix();
     }
 }
 
index 682d904eec7909954cdfa891b82d27c86539e977..4777e18fba68af980b06bc563b1025f296cef0ca 100644 (file)
@@ -221,14 +221,16 @@ void MemBuf::consume(mb_size_t shiftSize)
 }
 
 /// removes all whitespace prefix bytes and "packs" by moving content left
-void MemBuf::consumeWhitespace()
+void MemBuf::consumeWhitespacePrefix()
 {
     PROF_start(MemBuf_consumeWhitespace);
-    const char *end = buf + contentSize();
-    const char *p = buf;
-    for(; p<=end && xisspace(*p); ++p);
-    if (p-buf > 0)
-        consume(p-buf);
+    if (contentSize() > 0) {
+        const char *end = buf + contentSize();
+        const char *p = buf;
+        for(; p<end && xisspace(*p); ++p);
+        if (p-buf > 0)
+            consume(p-buf);
+    }
     PROF_stop(MemBuf_consumeWhitespace);
 }
 
index 421ac71ce68e20262f064254c9313d356ef8067f..e28124ff33e938f99e09b0abc9d82c52b64dc939 100644 (file)
@@ -81,7 +81,7 @@ public:
     /// \note there is currently no stretch() method to grow without appending
 
     void consume(mb_size_t sz);  // removes sz bytes, moving content left
-    void consumeWhitespace();    // removes all prefix whitespace, moving content left
+    void consumeWhitespacePrefix();    ///< removes all prefix whitespace, moving content left
 
     void append(const char *c, mb_size_t sz); // grows if needed and possible
     void appended(mb_size_t sz); // updates content size after external append
index b85d5d560fc96641c707d40bd00233fc8b63ca24..311121f0305f234aed32d9da8beacf4794dcbdd1 100644 (file)
@@ -715,11 +715,15 @@ DOC_START
 
        All response keyword values need to be a single token with URL
        escaping, or enclosed in double quotes (") and escaped using \ on
-       any quotes, whitespace or \ characters within the value
-       For example:
-               user="John\ Smith"
-               user="J.\ O\'Brien"
+       any double quotes or \ characters within the value. The wrapping
+       double quotes are removed before the value is interpreted by Squid.
+       \r and \n are also replace by CR and LF.
+
+       Some example key values:
+
                user=John%20Smith
+               user="John Smith"
+               user="J. \"Bob\" Smith"
 DOC_END
 
 NAME: acl
@@ -4131,12 +4135,12 @@ DOC_START
 
        For each requested URL, the rewriter will receive on line with the format
 
-         [channel-ID <SP>] URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kvpairs]<NL>
+         [channel-ID <SP>] URL <SP> client_ip "/" fqdn <SP> user <SP> method [<SP> kv-pairs]<NL>
 
 
        After processing the request the helper must reply using the following format:
 
-         [channel-ID <SP>] result [<SP> kvpairs]
+         [channel-ID <SP>] result [<SP> kv-pairs]
 
        The result code can be:
 
@@ -4161,7 +4165,7 @@ DOC_START
 
 
        In the future, the interface protocol will be extended with
-       key=value pairs ("kvpairs" shown above).  Helper programs
+       key=value pairs ("kv-pairs" shown above).  Helper programs
        should be prepared to receive and possibly ignore additional
        whitespace-separated tokens on each input line.