From: Amos Jeffries Date: Wed, 6 Aug 2008 13:27:10 +0000 (+1200) Subject: Fix: Unsupported method in request may show raw binary data in log. X-Git-Tag: SQUID_3_0_STABLE9~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3479c0a162e394114165a137830caf2a212b1eba;p=thirdparty%2Fsquid.git Fix: Unsupported method in request may show raw binary data in log. 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. --- diff --git a/src/client_side.cc b/src/client_side.cc index aa553a951f..d3adb6c92a 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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");