#include "helper.h"
#include "rfc1738.h"
#include "SquidString.h"
+#include "Debug.h"
HelperReply::HelperReply(char *buf, size_t len) :
result(HelperReply::Unknown),
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;
// 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)) {