]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2830: clarify where NULL byte is in headers.
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 22 Dec 2009 01:17:26 +0000 (14:17 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 22 Dec 2009 01:17:26 +0000 (14:17 +1300)
Debug printing used to naturally stop string output at the null byte.

This should show the first segment of headers up to the NULL and the
segment of headers after it. So that its clear to admin that there are
more headers _after_ the portion that used to be logged.

src/HttpHeader.cc

index 6af9135b2cfab2d2ff490c94b67e686f1ca6a2e6..44afec3eccd31fc640cb8bc3c8a98833b7911f4c 100644 (file)
@@ -504,9 +504,10 @@ HttpHeader::parse(const char *header_start, const char *header_end)
     debugs(55, 7, "parsing hdr: (" << this << ")" << std::endl << getStringPrefix(header_start, header_end));
     HttpHeaderStats[owner].parsedCount++;
 
-    if (memchr(header_start, '\0', header_end - header_start)) {
+    char *nulpos;
+    if ((nulpos = (char*)memchr(header_start, '\0', header_end - header_start))) {
         debugs(55, 1, "WARNING: HTTP header contains NULL characters {" << 
-                      getStringPrefix(header_start, header_end) << "}");
+               getStringPrefix(header_start, nulpos) << "}\nNULL\n{" << getStringPrefix(nulpos+1, header_end) << "}");
         goto reset;
     }