mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-29 08:08:37 +00:00
Add -t option which turns T/TCP off as workaround for some broken servers
Submitted by: Marc Slemko <marcs@znep.com>
This commit is contained in:
parent
e1a10354cb
commit
f4e4504f06
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27921
@ -1,4 +1,4 @@
|
||||
.\" $Id: fetch.1,v 1.17 1997/03/05 18:57:15 fenner Exp $
|
||||
.\" $Id: fetch.1,v 1.18 1997/07/25 19:35:41 wollman Exp $
|
||||
.Dd July 2, 1996
|
||||
.Dt FETCH 1
|
||||
.Os FreeBSD 2.2
|
||||
@ -99,6 +99,10 @@ The filenames specified are ``precious'', and should not be deleted
|
||||
under any circumstances, even if the transfer failed or was incomplete.
|
||||
.It Fl r
|
||||
Restart a previously interrupted transfer.
|
||||
.It Fl t
|
||||
Ensure that the use of T/TCP is not attempted for connections. This is
|
||||
used to workaround bugs in some remote OS stacks that give improper
|
||||
replies to T/TCP connections.
|
||||
.It Fl T Ar seconds
|
||||
Set timeout value to
|
||||
.Ar seconds.
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: fetch.h,v 1.3 1997/02/05 19:59:10 wollman Exp $
|
||||
* $Id: fetch.h,v 1.4 1997/07/25 19:35:42 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef fetch_h
|
||||
@ -50,6 +50,7 @@ struct fetch_state {
|
||||
int fs_precious; /* -R option */
|
||||
int fs_auto_retry; /* -a option */
|
||||
int fs_linux_bug; /* -b option */
|
||||
int fs_use_connect; /* -t option */
|
||||
time_t fs_modtime;
|
||||
void *fs_proto;
|
||||
int (*fs_retrieve)(struct fetch_state *);
|
||||
|
@ -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 @@ http_retrieve(struct fetch_state *fs)
|
||||
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);
|
||||
|
@ -24,7 +24,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: main.c,v 1.40 1997/07/02 06:28:32 charnier Exp $ */
|
||||
/* $Id: main.c,v 1.41 1997/07/25 19:35:44 wollman Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -73,7 +73,7 @@ main(int argc, char *const *argv)
|
||||
fs.fs_verbose = 1;
|
||||
change_to_dir = file_to_get = hostname = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, "abc:D:f:h:HilLmMnNo:pPqRrT:vV:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "abc:D:f:h:HilLmMnNo:pPqRrtT:vV:")) != -1) {
|
||||
switch (c) {
|
||||
case 'D': case 'H': case 'I': case 'N': case 'L': case 'V':
|
||||
break; /* ncftp compatibility */
|
||||
@ -130,6 +130,10 @@ main(int argc, char *const *argv)
|
||||
fs.fs_precious = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
fs.fs_use_connect = 1;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
/* strtol sets errno to ERANGE in the case of overflow */
|
||||
errno = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user