From: Amos Jeffries Date: Wed, 27 Jul 2011 12:15:49 +0000 (+1200) Subject: Display HTTP protocol syntax at section 11 level 2 X-Git-Tag: take08~55^2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1ce34ddd6e9c999e936c656814930b54ccfa9339;p=thirdparty%2Fsquid.git Display HTTP protocol syntax at section 11 level 2 This enables easy debugging of what HTTP requests and replies are flowing over the between Squid and external clients/servers. Avoiding the need for level-9 debug traces or packet-level deciphering. --- diff --git a/src/client_side.cc b/src/client_side.cc index f6ef921dcf..8a1713f39c 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -374,6 +374,9 @@ ClientSocketContext::writeControlMsg(HttpControlMsg &msg) MemBuf *mb = rep->pack(); + debugs(11, 2, "HTTP Client " << clientConnection); + debugs(11, 2, "HTTP Client CONTROL MSG:\n---------\n" << mb->buf << "\n----------"); + AsyncCall::Pointer call = commCbCall(33, 5, "ClientSocketContext::wroteControlMsg", CommIoCbPtrFun(&WroteControlMsg, this)); Comm::Write(clientConnection, mb, call); @@ -1352,6 +1355,11 @@ ClientSocketContext::sendStartOfMessage(HttpReply * rep, StoreIOBuffer bodyData) prepareReply(rep); assert (rep); MemBuf *mb = rep->pack(); + + // dump now, so we dont output any body. + debugs(11, 2, "HTTP Client " << clientConnection); + debugs(11, 2, "HTTP Client REPLY:\n---------\n" << mb->buf << "\n----------"); + /* Save length of headers for persistent conn checks */ http->out.headers_sz = mb->contentSize(); #if HEADERS_LOG @@ -2274,6 +2282,11 @@ parseHttpRequest(ConnStateData *csd, HttpParser *hp, HttpRequestMethod * method_ } debugs(33, 5, "parseHttpRequest: Complete request received"); + + // XXX: crop this dump at the end of headers. No need for extras + debugs(11, 2, "HTTP Client " << csd->clientConnection); + debugs(11, 2, "HTTP Client REQUEST:\n---------\n" << (hp->buf) + hp->req.m_start << "\n----------"); + result->flags.parsed_ok = 1; xfree(url); return result; diff --git a/src/http.cc b/src/http.cc index eb52abcfba..780b7b73ed 100644 --- a/src/http.cc +++ b/src/http.cc @@ -687,7 +687,8 @@ HttpStateData::processReplyHeader() return; } - debugs(11, 9, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------"); + debugs(11, 2, "HTTP Server " << serverConnection); + debugs(11, 2, "HTTP Server REPLY:\n---------\n" << readBuf->content() << "\n----------"); header_bytes_read = headersEnd(readBuf->content(), readBuf->contentSize()); readBuf->consume(header_bytes_read); @@ -2124,9 +2125,11 @@ HttpStateData::sendRequest() mb.init(); request->peer_host=_peer?_peer->host:NULL; buildRequestPrefix(&mb); - debugs(11, 6, HERE << serverConnection << ":\n" << mb.buf); - Comm::Write(serverConnection, &mb, requestSender); + debugs(11, 2, "HTTP Server " << serverConnection); + debugs(11, 2, "HTTP Server REQUEST:\n---------\n" << mb.buf << "\n----------"); + + Comm::Write(serverConnection, &mb, requestSender); return true; }