diff options
Diffstat (limited to 'usr.bin/fetch/http.c')
-rw-r--r-- | usr.bin/fetch/http.c | 16 |
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); |