aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/socksd.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/server/socksd.c b/tests/server/socksd.c
index 813eca665..e6e9c12b0 100644
--- a/tests/server/socksd.c
+++ b/tests/server/socksd.c
@@ -883,6 +883,7 @@ int main(int argc, char *argv[])
curl_socket_t msgsock = CURL_SOCKET_BAD;
int wrotepidfile = 0;
const char *pidname = ".socksd.pid";
+ const char *portfile = NULL;
bool juggle_again;
int error;
int arg = 1;
@@ -903,6 +904,11 @@ int main(int argc, char *argv[])
if(argc>arg)
pidname = argv[arg++];
}
+ else if(!strcmp("--portfile", argv[arg])) {
+ arg++;
+ if(argc>arg)
+ portfile = argv[arg++];
+ }
else if(!strcmp("--config", argv[arg])) {
arg++;
if(argc>arg)
@@ -943,12 +949,6 @@ int main(int argc, char *argv[])
if(argc>arg) {
char *endptr;
unsigned long ulnum = strtoul(argv[arg], &endptr, 10);
- if((endptr != argv[arg] + strlen(argv[arg])) ||
- ((ulnum != 0UL) && ((ulnum < 1025UL) || (ulnum > 65535UL)))) {
- fprintf(stderr, "socksd: invalid --port argument (%s)\n",
- argv[arg]);
- return 0;
- }
port = curlx_ultous(ulnum);
arg++;
}
@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
" --version\n"
" --logfile [file]\n"
" --pidfile [file]\n"
+ " --portfile [file]\n"
" --ipv4\n"
" --ipv6\n"
" --bindonly\n"
@@ -1013,6 +1014,13 @@ int main(int argc, char *argv[])
goto socks5_cleanup;
}
+ if(portfile) {
+ wrotepidfile = write_portfile(portfile, port);
+ if(!wrotepidfile) {
+ goto socks5_cleanup;
+ }
+ }
+
do {
juggle_again = incoming(sock);
} while(juggle_again);