summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/telnet.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-27 15:58:44 -0500
committerBrad King <brad.king@kitware.com>2023-01-27 15:58:44 -0500
commitf9f5957884c279af81766f3f339bdd0e768e814f (patch)
tree310f21f037896ac658f8d59e81fa671ee9dee1ef /Utilities/cmcurl/lib/telnet.c
parent39dcf9469d3dae1c319dbe9d1fbd86bef91b73e0 (diff)
parentdac458ddbf2b48168779821654a7e69cbd828c14 (diff)
downloadcmake-f9f5957884c279af81766f3f339bdd0e768e814f.tar.gz
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2022-12-21 (c12fb3dd)
Diffstat (limited to 'Utilities/cmcurl/lib/telnet.c')
-rw-r--r--Utilities/cmcurl/lib/telnet.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Utilities/cmcurl/lib/telnet.c b/Utilities/cmcurl/lib/telnet.c
index 923c7f82bd..22bc81e755 100644
--- a/Utilities/cmcurl/lib/telnet.c
+++ b/Utilities/cmcurl/lib/telnet.c
@@ -571,7 +571,7 @@ void rec_do(struct Curl_easy *data, int option)
sendsuboption(data, option);
}
else if(tn->subnegotiation[option] == CURL_YES) {
- /* send information to achieve this option*/
+ /* send information to achieve this option */
tn->us[option] = CURL_YES;
send_negotiation(data, CURL_WILL, option);
sendsuboption(data, option);
@@ -1200,7 +1200,7 @@ static CURLcode send_telnet_data(struct Curl_easy *data,
j = 0;
for(i = 0; i < nread; i++) {
- outbuf[j++] = buffer[i];
+ outbuf[j++] = (unsigned char)buffer[i];
if((unsigned char)buffer[i] == CURL_IAC)
outbuf[j++] = CURL_IAC;
}
@@ -1248,9 +1248,6 @@ static CURLcode telnet_done(struct Curl_easy *data,
curl_slist_free_all(tn->telnet_vars);
tn->telnet_vars = NULL;
-
- Curl_safefree(data->req.p.telnet);
-
return CURLE_OK;
}
@@ -1491,6 +1488,7 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
}
while(keepon) {
+ DEBUGF(infof(data, "telnet_do(handle=%p), poll %d fds", data, poll_cnt));
switch(Curl_poll(pfd, poll_cnt, interval_ms)) {
case -1: /* error, stop reading */
keepon = FALSE;
@@ -1509,6 +1507,14 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
/* returned not-zero, this an error */
if(result) {
keepon = FALSE;
+ /* TODO: in test 1452, macOS sees a ECONNRESET sometimes?
+ * Is this the telnet test server not shutting down the socket
+ * in a clean way? Seems to be timing related, happens more
+ * on slow debug build */
+ if(data->state.os_errno == ECONNRESET) {
+ DEBUGF(infof(data, "telnet_do(handle=%p), unexpected ECONNRESET"
+ " on recv", data));
+ }
break;
}
/* returned zero but actually received 0 or less here,