diff --git a/tests/server/sws.c b/tests/server/sws.c index 1e341cf0d0..5a2a155743 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -105,8 +105,6 @@ const char *serverlogfile = DEFAULT_LOGFILE; #define REQUEST_DUMP "log/server.input" #define RESPONSE_DUMP "log/server.response" -#define TEST_DATA_PATH "%s/data/test%ld" - /* very-big-path support */ #define MAXDOCNAMELEN 140000 #define MAXDOCNAMELEN_TXT "139999" @@ -117,9 +115,6 @@ const char *serverlogfile = DEFAULT_LOGFILE; #define END_OF_HEADERS "\r\n\r\n" -/* global variable, where to find the 'data' dir */ -const char *path="."; - enum { DOCNUMBER_NOTHING = -7, DOCNUMBER_QUIT = -6, @@ -169,14 +164,6 @@ static void sigpipe_handler(int sig) } #endif -static char *test2file(long testno) -{ - static char filename[256]; - sprintf(filename, TEST_DATA_PATH, path, testno); - return filename; -} - - int ProcessRequest(struct httprequest *req) { char *line=req->reqbuf; @@ -642,7 +629,8 @@ int main(int argc, char *argv[]) #ifdef ENABLE_IPV6 struct sockaddr_in6 me6; #endif /* ENABLE_IPV6 */ - int sock, msgsock, flag; + curl_socket_t sock, msgsock; + int flag; unsigned short port = DEFAULT_PORT; FILE *pidfile; char *pidname= (char *)".http.pid"; diff --git a/tests/server/util.c b/tests/server/util.c index 2b68971a12..93905c0ec3 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -144,3 +144,13 @@ void win32_cleanup(void) } #endif +/* set by the main code to point to where the test dir is */ +const char *path="."; + +char *test2file(long testno) +{ + static char filename[256]; + snprintf(filename, sizeof(filename), TEST_DATA_PATH, path, testno); + return filename; +} + diff --git a/tests/server/util.h b/tests/server/util.h index c4521fbaea..357b49cc93 100644 --- a/tests/server/util.h +++ b/tests/server/util.h @@ -33,6 +33,11 @@ void logmsg(const char *msg, ...); #define TRUE 1 #endif +#define TEST_DATA_PATH "%s/data/test%ld" + +/* global variable, where to find the 'data' dir */ +extern const char *path; + #if defined(WIN32) && !defined(__CYGWIN__) #include #include @@ -60,3 +65,6 @@ const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }}; void win32_init(void); void win32_cleanup(void); + +/* returns the path name to the test case file */ +char *test2file(long testno);