cURL / Mailing Lists / curl-library / Single Mail

curl-library

adding quit URL to sws

From: David Byron <DByron_at_everdreamcorp.com>
Date: Sat, 28 Jun 2003 11:28:45 -0700

Not sure if this patch is useful. I'm going to be making some other changes
to sws, but this may be the one that's generic to everyone. Time will
tell...

If you guys would rather I attach these, I can. This one seems small enough
that it's probably OK.

-DB

--- /cygdrive/c/archive/curl/curl-7.10.5-1/tests/server/sws.c 2003-04-03
05:43:16.000000000 -0800
+++ sws.c.new 2003-06-28 11:28:37.000000000 -0700
@@ -71,6 +71,7 @@
 #define TEST_DATA_PATH "data/test%d"
 
 enum {
+ DOCNUMBER_QUIT = -6,
   DOCNUMBER_BADCONNECT = -5,
   DOCNUMBER_INTERNAL= -4,
   DOCNUMBER_CONNECT = -3,
@@ -78,6 +79,12 @@
   DOCNUMBER_404 = -1
 };
 
+
+/* sent as reply to a QUIT */
+static const char *docquit =
+"HTTP/1.1 200 Goodbye\r\n"
+"\r\n";
+
 /* sent as reply to a CONNECT */
 static const char *docconnect =
 "HTTP/1.1 200 Mighty fine indeed\r\n"
@@ -279,6 +286,11 @@
         return DOCNUMBER_WERULEZ;
       }
 
+ if(!strncmp("/quit", ptr, 15)) {
+ logmsg("Request-to-quit received");
+ return DOCNUMBER_QUIT;
+ }
+
       ptr++; /* skip the slash */
 
       test_no = strtol(ptr, &ptr, 10);
@@ -338,6 +350,10 @@
 
   if(doc < 0) {
     switch(doc) {
+ case DOCNUMBER_QUIT:
+ logmsg("Replying to QUIT");
+ buffer = docquit;
+ break;
     case DOCNUMBER_WERULEZ:
       /* we got a "friends?" question, reply back that we sure are */
       logmsg("Identifying ourselves as friends");
@@ -529,6 +545,9 @@
 
     logmsg("Closing client connection");
     close(msgsock);
+
+ if (doc == DOCNUMBER_QUIT)
+ break;
   }
   
   close(sock);

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
Received on 2003-06-28