mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
Added TELNET timeout support for Windows builds
This commit is contained in:
parent
662727ca3e
commit
f1db505778
4
CHANGES
4
CHANGES
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Yang Tse (11 Mar 2009)
|
||||||
|
- Added missing TELNET timeout support for Windows builds. This issue was
|
||||||
|
reported by Pierre Brico.
|
||||||
|
|
||||||
Daniel Stenberg (9 Mar 2009)
|
Daniel Stenberg (9 Mar 2009)
|
||||||
- Frank Hempel found out a bug and provided the fix:
|
- Frank Hempel found out a bug and provided the fix:
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ This release includes the following bugfixes:
|
|||||||
o fixed the GnuTLS-using code to do correct return code checks
|
o fixed the GnuTLS-using code to do correct return code checks
|
||||||
o an alloc-related call in the OpenSSL-using code didn't check the return value
|
o an alloc-related call in the OpenSSL-using code didn't check the return value
|
||||||
o curl_easy_duphandle() failed to duplicate cookies at times
|
o curl_easy_duphandle() failed to duplicate cookies at times
|
||||||
|
o missing TELNET timeout support in Windows builds
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
@ -27,6 +28,6 @@ This release would not have looked like this without help, code, reports and
|
|||||||
advice from friends like these:
|
advice from friends like these:
|
||||||
|
|
||||||
Daniel Fandrich, Yang Tse, David James, Chris Deidun, Bill Egert,
|
Daniel Fandrich, Yang Tse, David James, Chris Deidun, Bill Egert,
|
||||||
Andre Guibert de Bruet, Andreas Farber, Frank Hempel
|
Andre Guibert de Bruet, Andreas Farber, Frank Hempel, Pierre Brico
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
30
lib/telnet.c
30
lib/telnet.c
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -1195,11 +1195,13 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
DWORD wait_timeout;
|
DWORD wait_timeout;
|
||||||
DWORD waitret;
|
DWORD waitret;
|
||||||
DWORD readfile_read;
|
DWORD readfile_read;
|
||||||
|
int err;
|
||||||
#else
|
#else
|
||||||
int interval_ms;
|
int interval_ms;
|
||||||
struct pollfd pfd[2];
|
struct pollfd pfd[2];
|
||||||
#endif
|
#endif
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
struct timeval now;
|
||||||
bool keepon = TRUE;
|
bool keepon = TRUE;
|
||||||
char *buf = data->state.buffer;
|
char *buf = data->state.buffer;
|
||||||
struct TELNET *tn;
|
struct TELNET *tn;
|
||||||
@ -1305,7 +1307,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
wait_timeout = 100;
|
wait_timeout = 100;
|
||||||
} else {
|
} else {
|
||||||
obj_count = 2;
|
obj_count = 2;
|
||||||
wait_timeout = INFINITE;
|
wait_timeout = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep on listening and act on events */
|
/* Keep on listening and act on events */
|
||||||
@ -1358,8 +1360,15 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
if(enum_netevents_func(sockfd, event_handle, &events)
|
|
||||||
!= SOCKET_ERROR) {
|
if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) {
|
||||||
|
if((err = SOCKERRNO) != EINPROGRESS) {
|
||||||
|
infof(data,"WSAEnumNetworkEvents failed (%d)", err);
|
||||||
|
keepon = FALSE;
|
||||||
|
code = CURLE_READ_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(events.lNetworkEvents & FD_READ) {
|
if(events.lNetworkEvents & FD_READ) {
|
||||||
/* This reallu OUGHT to check its return code. */
|
/* This reallu OUGHT to check its return code. */
|
||||||
(void)Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);
|
(void)Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);
|
||||||
@ -1376,12 +1385,20 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
tn->already_negotiated = 1;
|
tn->already_negotiated = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(events.lNetworkEvents & FD_CLOSE) {
|
if(events.lNetworkEvents & FD_CLOSE) {
|
||||||
keepon = FALSE;
|
keepon = FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data->set.timeout) {
|
||||||
|
now = Curl_tvnow();
|
||||||
|
if(Curl_tvdiff(now, conn->created) >= data->set.timeout) {
|
||||||
|
failf(data, "Time-out");
|
||||||
|
code = CURLE_OPERATION_TIMEDOUT;
|
||||||
|
keepon = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1446,7 +1463,6 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(data->set.timeout) {
|
if(data->set.timeout) {
|
||||||
struct timeval now; /* current time */
|
|
||||||
now = Curl_tvnow();
|
now = Curl_tvnow();
|
||||||
if(Curl_tvdiff(now, conn->created) >= data->set.timeout) {
|
if(Curl_tvdiff(now, conn->created) >= data->set.timeout) {
|
||||||
failf(data, "Time-out");
|
failf(data, "Time-out");
|
||||||
|
Loading…
Reference in New Issue
Block a user