summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/telnet.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-08-03 18:26:53 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-03 18:26:53 (GMT)
commitf53f4a8a2d215dac634effea575a27e000dfcb29 (patch)
tree5782e71da9e12ab6081e47f8eaf8eeb908e1428a /Utilities/cmcurl/lib/telnet.c
parente1c11352f231ae310339cd539ed59cb302bd4dbe (diff)
parent202adcfe056681109fe61569ecdb3bd69f0b4f97 (diff)
downloadCMake-f53f4a8a2d215dac634effea575a27e000dfcb29.zip
CMake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.gz
CMake-f53f4a8a2d215dac634effea575a27e000dfcb29.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2016-08-03 (f2cb3a01)
Diffstat (limited to 'Utilities/cmcurl/lib/telnet.c')
-rw-r--r--Utilities/cmcurl/lib/telnet.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/Utilities/cmcurl/lib/telnet.c b/Utilities/cmcurl/lib/telnet.c
index aabf99d..cc705cf 100644
--- a/Utilities/cmcurl/lib/telnet.c
+++ b/Utilities/cmcurl/lib/telnet.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@@ -51,7 +51,7 @@
#include "telnet.h"
#include "connect.h"
#include "progress.h"
-#include "curl_printf.h"
+#include "system_win32.h"
#define TELOPTS
#define TELCMDS
@@ -62,7 +62,8 @@
#include "rawstr.h"
#include "warnless.h"
-/* The last #include files should be: */
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
@@ -91,7 +92,7 @@
#ifdef USE_WINSOCK
typedef FARPROC WSOCK2_FUNC;
-static CURLcode check_wsock2 ( struct SessionHandle *data );
+static CURLcode check_wsock2 (struct Curl_easy *data);
#endif
static
@@ -100,7 +101,7 @@ CURLcode telrcv(struct connectdata *,
ssize_t count); /* Number of bytes received */
#ifndef CURL_DISABLE_VERBOSE_STRINGS
-static void printoption(struct SessionHandle *data,
+static void printoption(struct Curl_easy *data,
const char *direction,
int cmd, int option);
#endif
@@ -110,7 +111,7 @@ static void send_negotiation(struct connectdata *, int cmd, int option);
static void set_local_option(struct connectdata *, int cmd, int option);
static void set_remote_option(struct connectdata *, int cmd, int option);
-static void printsub(struct SessionHandle *data,
+static void printsub(struct Curl_easy *data,
int direction, unsigned char *pointer,
size_t length);
static void suboption(struct connectdata *);
@@ -198,7 +199,7 @@ const struct Curl_handler Curl_handler_telnet = {
#ifdef USE_WINSOCK
static CURLcode
-check_wsock2 ( struct SessionHandle *data )
+check_wsock2(struct Curl_easy *data)
{
int err;
WORD wVersionRequested;
@@ -305,7 +306,7 @@ static void negotiate(struct connectdata *conn)
}
#ifndef CURL_DISABLE_VERBOSE_STRINGS
-static void printoption(struct SessionHandle *data,
+static void printoption(struct Curl_easy *data,
const char *direction, int cmd, int option)
{
const char *fmt;
@@ -346,7 +347,7 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option)
unsigned char buf[3];
ssize_t bytes_written;
int err;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
buf[0] = CURL_IAC;
buf[1] = (unsigned char)cmd;
@@ -702,7 +703,7 @@ void rec_dont(struct connectdata *conn, int option)
}
-static void printsub(struct SessionHandle *data,
+static void printsub(struct Curl_easy *data,
int direction, /* '<' or '>' */
unsigned char *pointer, /* where suboption data is */
size_t length) /* length of suboption data */
@@ -821,7 +822,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
struct curl_slist *beg;
char option_keyword[128] = "";
char option_arg[256] = "";
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
CURLcode result = CURLE_OK;
int binary_option;
@@ -931,7 +932,7 @@ static void suboption(struct connectdata *conn)
int err;
char varname[128] = "";
char varval[128] = "";
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct TELNET *tn = (struct TELNET *)data->req.protop;
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2);
@@ -1006,7 +1007,7 @@ static void sendsuboption(struct connectdata *conn, int option)
unsigned short x, y;
unsigned char*uc1, *uc2;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct TELNET *tn = (struct TELNET *)data->req.protop;
switch (option) {
@@ -1064,7 +1065,7 @@ CURLcode telrcv(struct connectdata *conn,
CURLcode result;
int in = 0;
int startwrite=-1;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct TELNET *tn = (struct TELNET *)data->req.protop;
#define startskipping() \
@@ -1281,7 +1282,7 @@ static CURLcode telnet_done(struct connectdata *conn,
static CURLcode telnet_do(struct connectdata *conn, bool *done)
{
CURLcode result;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
#ifdef USE_WINSOCK
HMODULE wsock2;
@@ -1334,7 +1335,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
/* OK, so we have WinSock 2.0. We need to dynamically */
/* load ws2_32.dll and get the function pointers we need. */
- wsock2 = LoadLibrary(TEXT("WS2_32.DLL"));
+ wsock2 = Curl_load_library(TEXT("WS2_32.DLL"));
if(wsock2 == NULL) {
failf(data, "failed to load WS2_32.DLL (%d)", ERRNO);
return CURLE_FAILED_INIT;
@@ -1423,8 +1424,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
for(;;) {
if(data->set.is_fread_set) {
/* read from user-supplied method */
- result = (int)data->set.fread_func(buf, 1, BUFSIZE - 1,
- data->set.in);
+ result = (int)data->state.fread_func(buf, 1, BUFSIZE - 1,
+ data->state.in);
if(result == CURL_READFUNC_ABORT) {
keepon = FALSE;
result = CURLE_READ_ERROR;
@@ -1563,13 +1564,13 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
pfd[0].fd = sockfd;
pfd[0].events = POLLIN;
- if(data->set.fread_func != (curl_read_callback)fread) {
+ if(data->set.is_fread_set) {
poll_cnt = 1;
interval_ms = 100; /* poll user-supplied read function */
}
else {
/* really using fread, so infile is a FILE* */
- pfd[1].fd = fileno((FILE *)data->set.in);
+ pfd[1].fd = fileno((FILE *)data->state.in);
pfd[1].events = POLLIN;
poll_cnt = 2;
interval_ms = 1 * 1000;
@@ -1628,7 +1629,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
}
else {
/* read from user-supplied method */
- nread = (int)data->set.fread_func(buf, 1, BUFSIZE - 1, data->set.in);
+ nread = (int)data->state.fread_func(buf, 1, BUFSIZE - 1,
+ data->state.in);
if(nread == CURL_READFUNC_ABORT) {
keepon = FALSE;
break;