mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
Avoid the use of the '? :' operator inside the call to our
test-server logging function. It doesn't work on some systems.
This commit is contained in:
parent
985bd18904
commit
57ee847ce7
@ -61,7 +61,10 @@
|
|||||||
/* include memdebug.h last */
|
/* include memdebug.h last */
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
static char use_ipv6=FALSE;
|
#ifdef ENABLE_IPV6
|
||||||
|
static bool use_ipv6 = FALSE;
|
||||||
|
#endif
|
||||||
|
static const char *ipv_inuse = "IPv4";
|
||||||
|
|
||||||
const char *serverlogfile=""; /* for a util.c function we don't use */
|
const char *serverlogfile=""; /* for a util.c function we don't use */
|
||||||
|
|
||||||
@ -84,13 +87,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
use_ipv6=TRUE;
|
ipv_inuse = "IPv6";
|
||||||
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
/* for completeness, we support this option as well */
|
/* for completeness, we support this option as well */
|
||||||
use_ipv6=FALSE;
|
#ifdef ENABLE_IPV6
|
||||||
|
ipv_inuse = "IPv4";
|
||||||
|
use_ipv6 = FALSE;
|
||||||
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -136,7 +143,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(rc)
|
if(rc)
|
||||||
printf("Resolving IPv%d '%s' didn't work\n", (use_ipv6?6:4), host);
|
printf("Resolving %s '%s' didn't work\n", ipv_inuse, host);
|
||||||
|
|
||||||
return !rc?0:1;
|
return !rc?0:1;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,10 @@
|
|||||||
const char *serverlogfile = DEFAULT_LOGFILE;
|
const char *serverlogfile = DEFAULT_LOGFILE;
|
||||||
|
|
||||||
static bool verbose = FALSE;
|
static bool verbose = FALSE;
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
static bool use_ipv6 = FALSE;
|
static bool use_ipv6 = FALSE;
|
||||||
|
#endif
|
||||||
|
static const char *ipv_inuse = "IPv4";
|
||||||
static unsigned short port = DEFAULT_PORT;
|
static unsigned short port = DEFAULT_PORT;
|
||||||
static unsigned short connectport = 0; /* if non-zero, we activate this mode */
|
static unsigned short connectport = 0; /* if non-zero, we activate this mode */
|
||||||
|
|
||||||
@ -542,7 +545,7 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||||||
else if(!memcmp("PORT", buffer, 4)) {
|
else if(!memcmp("PORT", buffer, 4)) {
|
||||||
/* Question asking us what PORT number we are listening to.
|
/* Question asking us what PORT number we are listening to.
|
||||||
Replies to PORT with "IPv[num]/[port]" */
|
Replies to PORT with "IPv[num]/[port]" */
|
||||||
sprintf((char *)buffer, "IPv%d/%d\n", use_ipv6?6:4, (int)port);
|
sprintf((char *)buffer, "%s/%d\n", ipv_inuse, (int)port);
|
||||||
buffer_len = (ssize_t)strlen((char *)buffer);
|
buffer_len = (ssize_t)strlen((char *)buffer);
|
||||||
snprintf(data, sizeof(data), "PORT\n%04x\n", buffer_len);
|
snprintf(data, sizeof(data), "PORT\n%04x\n", buffer_len);
|
||||||
if(!write_stdout(data, 10))
|
if(!write_stdout(data, 10))
|
||||||
@ -805,13 +808,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
use_ipv6=TRUE;
|
ipv_inuse = "IPv6";
|
||||||
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
/* for completeness, we support this option as well */
|
/* for completeness, we support this option as well */
|
||||||
use_ipv6=FALSE;
|
#ifdef ENABLE_IPV6
|
||||||
|
ipv_inuse = "IPv4";
|
||||||
|
use_ipv6 = FALSE;
|
||||||
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else if(!strcmp("--port", argv[arg])) {
|
else if(!strcmp("--port", argv[arg])) {
|
||||||
@ -921,8 +928,7 @@ int main(int argc, char *argv[])
|
|||||||
msgsock = CURL_SOCKET_BAD; /* no stream socket yet */
|
msgsock = CURL_SOCKET_BAD; /* no stream socket yet */
|
||||||
}
|
}
|
||||||
|
|
||||||
logmsg("Running IPv%d version",
|
logmsg("Running %s version", ipv_inuse);
|
||||||
(use_ipv6?6:4));
|
|
||||||
|
|
||||||
if(connectport)
|
if(connectport)
|
||||||
logmsg("Connected to port %hu", connectport);
|
logmsg("Connected to port %hu", connectport);
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
static bool use_ipv6 = FALSE;
|
static bool use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
const char *ipv_inuse = "IPv4";
|
static const char *ipv_inuse = "IPv4";
|
||||||
|
|
||||||
#define REQBUFSIZ 150000
|
#define REQBUFSIZ 150000
|
||||||
#define REQBUFSIZ_TXT "149999"
|
#define REQBUFSIZ_TXT "149999"
|
||||||
|
@ -96,6 +96,11 @@
|
|||||||
/* include memdebug.h last */
|
/* include memdebug.h last */
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
static bool use_ipv6 = FALSE;
|
||||||
|
#endif
|
||||||
|
static const char *ipv_inuse = "IPv4";
|
||||||
|
|
||||||
struct testcase {
|
struct testcase {
|
||||||
char *buffer; /* holds the file data to send to the client */
|
char *buffer; /* holds the file data to send to the client */
|
||||||
size_t bufsize; /* size of the data in buffer */
|
size_t bufsize; /* size of the data in buffer */
|
||||||
@ -407,7 +412,6 @@ const char *serverlogfile = DEFAULT_LOGFILE;
|
|||||||
|
|
||||||
#define REQUEST_DUMP "log/server.input"
|
#define REQUEST_DUMP "log/server.input"
|
||||||
|
|
||||||
static char use_ipv6=FALSE;
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -445,7 +449,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
use_ipv6=TRUE;
|
ipv_inuse = "IPv6";
|
||||||
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
@ -515,8 +520,7 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
logmsg("Running IPv%d version on port UDP/%hu",
|
logmsg("Running %s version on port UDP/%d", ipv_inuse, (int)port);
|
||||||
(use_ipv6?6:4), port);
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fromlen = sizeof(from);
|
fromlen = sizeof(from);
|
||||||
|
Loading…
Reference in New Issue
Block a user