Re: /bzr/squid3/trunk/ r11299: Bug 3007: CONNECT to cache_peer returns 000 status code

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Fri, 18 Mar 2011 10:41:13 -0600

On 03/18/2011 12:42 AM, Amos Jeffries wrote:
> ------------------------------------------------------------
> revno: 11299
> fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3007
> author: Mikio Kishi <mkishi_at_104.net>
> committer: Amos Jeffries <squid3_at_treenet.co.nz>
> branch nick: trunk
> timestamp: Fri 2011-03-18 19:42:32 +1300
> message:
> Bug 3007: CONNECT to cache_peer returns 000 status code
> modified:
> src/tunnel.cc

> === modified file 'src/tunnel.cc'
> --- a/src/tunnel.cc 2010-11-28 01:15:27 +0000
> +++ b/src/tunnel.cc 2011-03-18 06:42:32 +0000
> @@ -526,6 +526,9 @@
> static void
> tunnelProxyConnectedWriteDone(int fd, char *buf, size_t size, comm_err_t flag, int xerrno, void *data)
> {
> + TunnelStateData *tunnelState = static_cast<TunnelStateData *>(data);
> + debugs(26, 3, HERE << "FD " << fd << " tunnelState=" << tunnelState);
> + *tunnelState->status_ptr = HTTP_OK;
> tunnelConnectedWriteDone(fd, buf, size, flag, xerrno, data);
> }
>

Seems wrong to set HTTP_OK even if the write failed. Besides, we have
already set tunnelState->status_ptr to HTTP_OK right before scheduling
the above callback:

> static void
> tunnelConnected(int fd, void *data)
> {
> TunnelStateData *tunnelState = (TunnelStateData *)data;
> debugs(26, 3, "tunnelConnected: FD " << fd << " tunnelState=" << tunnelState);
> *tunnelState->status_ptr = HTTP_OK;
> AsyncCall::Pointer call = commCbCall(5,5, "tunnelConnectedWriteDone",
> CommIoCbPtrFun(tunnelConnectedWriteDone, tunnelState));
> Comm::Write(tunnelState->client.fd(), conn_established, strlen(conn_established), call, NULL);
> }

Why do we need to set HTTP_OK twice?

Thank you,

Alex.
Received on Fri Mar 18 2011 - 16:41:23 MDT

This archive was generated by hypermail 2.2.0 : Sat Mar 19 2011 - 12:00:03 MDT