diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-10-09 08:12:43 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-10-09 08:12:43 +0000 |
commit | c29740f0d808e49e8fc1d300675be368816d0007 (patch) | |
tree | 7abe0bae4d459c011e2a02d634c0e0ac4df359fa | |
parent | 1a4fddb9ba0d0e255a32010741837a0b3a073714 (diff) |
portability fix by using setup.h from the lib directory
-rw-r--r-- | tests/server/Makefile.am | 2 | ||||
-rw-r--r-- | tests/server/sws.c | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/tests/server/Makefile.am b/tests/server/Makefile.am index cb98c20e1..60886e210 100644 --- a/tests/server/Makefile.am +++ b/tests/server/Makefile.am @@ -5,6 +5,8 @@ AUTOMAKE_OPTIONS = foreign +INCLUDES = -I$(top_srcdir)/lib + noinst_PROGRAMS = sws sws_SOURCES= sws.c getpart.c diff --git a/tests/server/sws.c b/tests/server/sws.c index 147de9af4..8ee2e96ef 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -27,6 +27,7 @@ Wilke. Thanks a bunch! */ +#include "setup.h" /* portability help from the lib directory */ #include <stdio.h> #include <stdlib.h> @@ -64,7 +65,7 @@ spitout(FILE *stream, #define DEFAULT_LOGFILE "log/sws.log" #endif -#define VERSION "cURL test suite HTTP server/0.1" +#define SWSVERSION "cURL test suite HTTP server/0.1" #define REQUEST_DUMP "log/server.input" #define RESPONSE_DUMP "log/server.response" @@ -98,7 +99,7 @@ static const char *docbadconnect = /* send back this on 404 file not found */ static const char *doc404 = "HTTP/1.1 404 Not Found\n" - "Server: " VERSION "\n" + "Server: " SWSVERSION "\n" "Connection: close\n" "Content-Type: text/html\n" "\n" @@ -108,7 +109,7 @@ static const char *doc404 = "HTTP/1.1 404 Not Found\n" "</HEAD><BODY>\n" "<H1>Not Found</H1>\n" "The requested URL was not found on this server.\n" - "<P><HR><ADDRESS>" VERSION "</ADDRESS>\n" "</BODY></HTML>\n"; + "<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n" "</BODY></HTML>\n"; #ifdef HAVE_SIGNAL static volatile int sigpipe; @@ -241,7 +242,7 @@ static int get_request(int sock, int *part, int *open) *open = TRUE; /* connection should remain open and wait for more commands */ while (offset < REQBUFSIZ) { - int got = recv(sock, reqbuf + offset, REQBUFSIZ - offset, 0); + int got = sread(sock, reqbuf + offset, REQBUFSIZ - offset); if (got <= 0) { if (got < 0) { perror("recv"); @@ -471,7 +472,7 @@ static int send_doc(int sock, } do { - written = send(sock, buffer, count, 0); + written = swrite(sock, buffer, count); if (written < 0) { logmsg("Sending response failed and we bailed out!"); return -1; @@ -609,13 +610,13 @@ int main(int argc, char *argv[]) } while(open || (doc == DOCNUMBER_CONNECT)); logmsg("Closing client connection"); - close(msgsock); + sclose(msgsock); if (doc == DOCNUMBER_QUIT) break; } - close(sock); + sclose(sock); fclose(logfp); return 0; |