summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch/http.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-08-05 20:18:39 +0000
committerache <ache@FreeBSD.org>1997-08-05 20:18:39 +0000
commitfbd1e32f9160ae4d4343706bf63cb07a2452250c (patch)
tree296ba1ca95bbef22a77abfbcdbb6c46fded9a911 /usr.bin/fetch/http.c
parentee162dd22f64c7b9653b65be570f0a70fc2607bd (diff)
downloadFreeBSD-src-fbd1e32f9160ae4d4343706bf63cb07a2452250c.zip
FreeBSD-src-fbd1e32f9160ae4d4343706bf63cb07a2452250c.tar.gz
Add -t option which turns T/TCP off as workaround for some broken servers
Submitted by: Marc Slemko <marcs@znep.com>
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 6f4211d..fcb221c 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);
OpenPOWER on IntegriCloud