]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2830: clarify where NULL byte is in headers.
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 2 Dec 2009 22:27:33 +0000 (11:27 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 2 Dec 2009 22:27:33 +0000 (11:27 +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 e0fba7b6860a9be28af0eea0032b8c89c5d1fe86..f6a91b9de1ed406c414191efcea3d31852bce175 100644 (file)
@@ -514,9 +514,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 = 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;
     }