Skip to content

Instantly share code, notes, and snippets.

@V-Alexeev
Last active October 22, 2017 11:55
Show Gist options
  • Save V-Alexeev/05a17a88626e009bf1bf2f9f0478f70d to your computer and use it in GitHub Desktop.
Save V-Alexeev/05a17a88626e009bf1bf2f9f0478f70d to your computer and use it in GitHub Desktop.
Patch for SAMS2 and Squid >= 3.2 (incomplete)
Index: src/samsredir.cpp
===================================================================
--- src/samsredir.cpp (revision 979)
+++ src/samsredir.cpp (working copy)
@@ -241,7 +241,7 @@
{
INFO ("Reason: Invalid fields count: " << fields.size());
INFO ("Output: " << line);
- cout << line << endl << flush;
+ cout << "ERR" << endl << flush;
continue;
}
@@ -252,7 +252,7 @@
{
INFO ("Reason: Url is local");
INFO ("Output: " << line);
- cout << line << endl << flush;
+ cout << "ERR" << endl << flush;
continue;
}
@@ -304,7 +304,7 @@
{
INFO ("Reason: In white list");
INFO ("Output: " << line);
- cout << line << endl << flush;
+ cout << "ERR" << endl << flush;
continue;
}
@@ -370,7 +370,7 @@
// Все проверки пройдены успешно, разрешаем доступ
INFO ("Reason: Access granted");
INFO ("Output: " << line);
- cout << line << endl << flush;
+ cout << "ERR" << endl << flush;
}
delete conn;
Index: src/squidlogline.h
===================================================================
--- src/squidlogline.h (revision 979)
+++ src/squidlogline.h (working copy)
@@ -89,7 +89,9 @@
ERR_CLIENT_ABORT, ///< The client aborted its request
ERR_NO_CLIENTS, ///< There are no clients requesting this URL any more
ERR_READ_ERROR, ///< There was a read(2) error while retrieving this object
- ERR_CONNECT_FAIL ///< Squid failed to connect to the server for this request
+ ERR_CONNECT_FAIL, ///< Squid failed to connect to the server for this request
+ TCP_TUNNEL,
+ TAG_NONE
};
/**
Index: src/squidlogline.cpp
===================================================================
--- src/squidlogline.cpp (revision 979)
+++ src/squidlogline.cpp (working copy)
@@ -95,13 +95,13 @@
{
logCacheResult res;
- if (cr == "TCP_HIT")
+ if (cr == "TCP_HIT" || cr == "TCP_HIT_ABORTED")
res = TCP_HIT;
else if (cr == "TCP_MEM_HIT")
res = TCP_MEM_HIT;
else if (cr == "TCP_NEGATIVE_HIT")
res = TCP_NEGATIVE_HIT;
- else if (cr == "TCP_MISS")
+ else if (cr == "TCP_MISS" || cr == "TCP_MISS_ABORTED")
res = TCP_MISS;
else if (cr == "TCP_REFRESH_HIT")
res = TCP_REFRESH_HIT;
@@ -125,7 +125,7 @@
res = TCP_SWAPFAIL;
else if (cr == "TCP_SWAPFAIL_MISS")
res = TCP_SWAPFAIL_MISS;
- else if (cr == "TCP_DENIED")
+ else if (cr == "TCP_DENIED" || cr == "TCP_DENIED_ABORTED")
res = TCP_DENIED;
else if (cr == "UDP_HIT")
res = UDP_HIT;
@@ -147,6 +147,10 @@
res = ERR_READ_ERROR;
else if (cr == "ERR_CONNECT_FAIL")
res = ERR_CONNECT_FAIL;
+ else if (cr == "TCP_TUNNEL")
+ res = TCP_TUNNEL;
+ else if (cr == "TAG_NONE" || cr == "TAG_NONE_ABORTED")
+ res = TAG_NONE;
else
{
WARNING ("Unknown cache result " << cr);
@@ -332,6 +336,8 @@
res = "TCP_SWAPFAIL_MISS";
else if (cr == TCP_DENIED)
res = "TCP_DENIED";
+ else if (cr == TCP_TUNNEL)
+ res = "TCP_TUNNEL";
else if (cr == UDP_HIT)
res = "UDP_HIT";
else if (cr == UDP_HIT_OBJ)
Index: src/squidlogparser.cpp
===================================================================
--- src/squidlogparser.cpp (revision 979)
+++ src/squidlogparser.cpp (working copy)
@@ -473,6 +473,8 @@
case SquidLogLine::ERR_NO_CLIENTS:
case SquidLogLine::ERR_READ_ERROR:
case SquidLogLine::ERR_CONNECT_FAIL:
+ case SquidLogLine::TCP_TUNNEL:
+ case SquidLogLine::TAG_NONE:
s_size = sll.getSize ();
usr->addSize (s_size);
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment