]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Polish debugging on HelperReply parse
authorEliezer Croitoru <eliezer@ngtech.co.il>
Sun, 3 Feb 2013 05:45:19 +0000 (18:45 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 Feb 2013 05:45:19 +0000 (18:45 +1300)
src/HelperReply.cc

index 2b416c6d70caa78b7bb520f3b20af34cb79a7022..847cbf36469ebd3f1e5cd692ab74a018586068ca 100644 (file)
@@ -8,6 +8,7 @@
 #include "helper.h"
 #include "rfc1738.h"
 #include "SquidString.h"
+#include "Debug.h"
 
 HelperReply::HelperReply(char *buf, size_t len) :
         result(HelperReply::Unknown),
@@ -19,9 +20,11 @@ HelperReply::HelperReply(char *buf, size_t len) :
 void
 HelperReply::parse(char *buf, size_t len)
 {
+    debugs(84, 3, "Parsing helper buffer");
     // check we have something to parse
     if (!buf || len < 1) {
         // for now ensure that legacy handlers are not presented with NULL strings.
+        debugs(84, 3, "Reply length is smaller than 1 or none at all ");
         other_.init(1,1);
         other_.terminate();
         return;
@@ -33,15 +36,19 @@ HelperReply::parse(char *buf, size_t len)
     // URL-rewriter may return relative URLs or empty response for a large portion
     // of its replies.
     if (len >= 2) {
+        debugs(84, 3, "Buff length is larger than 2");
         // some helper formats (digest auth, URL-rewriter) just send a data string
         // we must also check for the ' ' character after the response token (if anything)
         if (!strncmp(p,"OK",2) && (len == 2 || p[2] == ' ')) {
+            debugs(84, 3, "helper Result = OK");
             result = HelperReply::Okay;
             p+=2;
         } else if (!strncmp(p,"ERR",3) && (len == 3 || p[3] == ' ')) {
+            debugs(84, 3, "helper Result = ERR");
             result = HelperReply::Error;
             p+=3;
         } else if (!strncmp(p,"BH",2) && (len == 2 || p[2] == ' ')) {
+            debugs(84, 3, "helper Result = BH");
             result = HelperReply::BrokenHelper;
             p+=2;
         } else if (!strncmp(p,"TT ",3)) {