]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix: Unsupported method in request may show raw binary data in log.
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 6 Aug 2008 13:27:10 +0000 (01:27 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 6 Aug 2008 13:27:10 +0000 (01:27 +1200)
hp->buf which should be a plain text HTTP request is occasionally full of
binary garbage.

 * replace any non-printables with underscores.

 * crop the output at 100 chars, we should not need a whole binary
   streaming video to identify the issue.

 * reference extension_methods for admin if its a genuine request.

src/client_side.cc

index aa553a951f242ecc3f83abde24c3d4e18246d150..d3adb6c92a6639ee15b001f70acae69337912681 100644 (file)
@@ -1891,8 +1891,17 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
     *method_p = HttpRequestMethod(&hp->buf[hp->m_start], &hp->buf[hp->m_end]);
 
     if (*method_p == METHOD_NONE) {
+        /* AYJ: hp->buf is occasionally full of binary crap. Replace any non-printables with underscores.
+                Also crop the output at 100 chars, we should not need a whole binary streaming video to identify the issue
+         */
+        char garbage[101];
+        memset(garbage, 0, 101);
+       for(int i=0; i < 100 && i < hp->bufsiz && hp->buf[i] != '\0'; i++)
+            garbage[i] = ((hp->buf[i] < ' ' || hp->buf[i] > '~' )? '_': hp->buf[i]);
+
         /* XXX need a way to say "this many character length string" */
-        debugs(33, 1, "clientParseRequestMethod: Unsupported method in request '" << hp->buf << "'");
+        debugs(33, 1, "clientParseRequestMethod: Unsupported method: This is not a bug. see squid.conf extension_methods");
+        debugs(33, 1, "clientParseRequestMethod: Unsupported method in request '" << tmp << "'");
 
         /* XXX where's the method set for this error? */
         return parseHttpRequestAbort(conn, "error:unsupported-request-method");