]> git.ipfire.org Git - thirdparty/squid.git/commit - src/client_side.cc
Propagate FTP server connection closures to idle FTP gw clients but
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Nov 2013 18:29:13 +0000 (11:29 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Nov 2013 18:29:13 +0000 (11:29 -0700)
commit89b1d7a2c87a4a12cedbf9a302a223fcdd6faefe
treee1e7a9e846f9622230e5b326b1d803dd7328cc91
parent000e664babaf79d53f8f0a009662decebebf5c15
Propagate FTP server connection closures to idle FTP gw clients but
carefully close the FTP server connection upon receiving an FTP 221 response.

FTP gateway code pins server connections; when there is no traffic, the
client-side code holds on to the server connection. The old code did not
notice pinned server connection closure until it was time to write the next
FTP request to that connection. Squid now monitors the idle pinned server
connection and closes the client connection if the server connection closes
(or, to be more precise, if the server connection gets marked as ready for
reading).

Client-side monitoring of an idle pinned connection ends when the server side
starts using the pinned connection again (because the server side becomes
responsible for monitoring EOF conditions then). Added
borrowPinnedConnection() and related methods to distinguish validation of
pinned connection and responsibility transfer.

Careful closure of the FTP server connection upon receiving an FTP 221
response is necessary to avoid the client-side idle server connection
monitoring code closing the client connection upon detecting server-side EOF
_before_ the client side had enough time to forward that 221 response to the
not-yet-idle client. The latter may take some time because, in part, the
response may have to go through an ICAP RESPMOD service first.
src/FtpGatewayServer.cc
src/FwdState.cc
src/client_side.cc
src/client_side.h
src/tests/stub_client_side.cc