aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/fetch/http.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-08-05 20:18:39 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-08-05 20:18:39 +0000
commitf4e4504f060177481bcdeb46edcbd37debd9ebad (patch)
tree3ad34e6addbd78847d2dfee13d936f6ca275d287 /usr.bin/fetch/http.c
parente1a10354cb2bb904da90e90b88ba6ab4a2c1ea9f (diff)
Notes
Diffstat (limited to 'usr.bin/fetch/http.c')
-rw-r--r--usr.bin/fetch/http.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/fetch/http.c b/usr.bin/fetch/http.c
index 6f4211dcd802..fcb221c250a8 100644
--- a/usr.bin/fetch/http.c
+++ b/usr.bin/fetch/http.c
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: http.c,v 1.9 1997/07/26 20:00:05 wollman Exp $
+ * $Id: http.c,v 1.10 1997/07/26 20:18:43 wollman Exp $
*/
#include <sys/types.h>
@@ -581,6 +581,20 @@ retry:
fs->fs_status = "sending request message";
setup_sigalrm();
alarm(timo);
+
+ /* some hosts do not properly handle T/TCP connections. If
+ * sendmsg() is used to establish the connection, the OS may
+ * choose to try to use one which could cause the transfer
+ * to fail. Doing a connect() first ensures that the OS
+ * does not attempt T/TCP.
+ */
+ if (fs->fs_use_connect && (connect(s, (struct sockaddr *)&sin,
+ sizeof(struct sockaddr_in)) < 0)) {
+ warn("connect: %s", https->http_hostname);
+ fclose(remote);
+ return EX_OSERR;
+ }
+
if (sendmsg(s, &msg, fs->fs_linux_bug ? 0 : MSG_EOF) < 0) {
warn("sendmsg: %s", https->http_hostname);
fclose(remote);