libfetch: Fix PROXY_HOST bug, socket leak, cache-crash
authorJohn Marino <draco@marino.st>
Thu, 1 Nov 2012 19:02:52 +0000 (20:02 +0100)
committerJohn Marino <draco@marino.st>
Thu, 1 Nov 2012 21:56:18 +0000 (22:56 +0100)
commitba1d801e083c520ff4cb89128deda9b887d6fd0b
tree72ed1bfa4f058975366d6bd25d65a149e22309e0
parent0a83ab6fe78d456ecf905bd6d1af72ca65c74da6
libfetch: Fix PROXY_HOST bug, socket leak, cache-crash

As described in FreeBSD PR kern/139751, NO_PROXY=localhost doesn't work
due to bad for loop count.

As described in FreeBSD PR kern/153748, an ftp-cached connection will
close the connection too early when trying to send a request.

There is a socket leak in ftp_request that occurs after a connection is
established.  Make sure socket is disconnected before exiting.

Taken-From: FreeBSD SVN 198339 (21 OCT 2009)
Taken-From: FreeBSD SVN 199801 (25 NOV 2009)
Taken-From: FreeBSD SVN 217505 (17 JAN 2011)
lib/libfetch/common.c
lib/libfetch/ftp.c