BUG/MEDIUM: http: unbreak redirects in legacy mode

As reported in github issue #334, HTTP redirects with no server result
in a 503 in legacy mode in 2.0 (and only this version).

What happens is that redirects have long relied on a corner case in the
connection setup code, which considered that a SHUTW_NOW would be turned
into a SHUTW and as a consequence, prevent the transition to ST_ST_REQ.
But during 2.0 development, this old assumption appeared to be broken
as it would prevent the master-worker CLI from receiving short commands
followed by a close : the one-line request was sent with the close and
the request was aborted before being turned into a connect for the applet.
The code setup sequence was then rearranged to address this, causing new
breakage which was then addressed by commits c9aecc8ff2 ("BUG/MEDIUM:
stream: Don't request a server connection if a shutw was scheduled") and
its fix 5e1a9d715e ("BUG/MEDIUM: stream: Fix the way early aborts on the
client side are handled") respectively. But at this point the redirect
code relying on SHUTW_NOW alone causes a transition to SI_ST_REQ since
it doesn't remove AUTO_CONNECT, and while the redirect respnse is loaded
into the response buffer, the 503 wipes everything and aborts.

Note that this doesn't happen in HTX mode because HTX redirects make use
of channel_abort() on the request, which does remove AUTO_CONNECT.

We'd rather not use channel_abort() in legacy as it also closes the read
side and will terminate keep-alive. Instead this patch simply adds the
required channel_dont_connect() to the redirect code to perform exactly
what's missing: prevent the connection from being automatically setup.
It doesn't seem that other parts of the code would require anything
similar. In fact the redirects and errors are the only cases where a
message is inserted into the response channel before connecting to
anything (other cases involve an applet). And error files are not
subject to this problem because channel_abort() is used, thus
AUTO_CONNECT is properly cleared.

This commit is solely for 2.0. It doesn't have any equivalent in 2.1 as
legacy code was removed. It doesn't need to be backported as 1.9 and
earlier are still sensitive to the SHUTW_NOW flag alone. However it
should be safe to backport it there if another fix would depend on it.
1 file changed