aboutsummaryrefslogtreecommitdiff
path: root/tests/server/sws.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2012-07-05 09:31:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2012-07-05 11:24:23 +0200
commit28dc509dde13e0f8da1b5dca2979d936609a4698 (patch)
treec0d74e0ca51e81bac5bf15361764f771e3f2804e /tests/server/sws.c
parent897cf5d1175fc4757cf71a7bd45d531c7f50dec3 (diff)
sws: add 'connection-monitor' command support
Using this, the server will output in the protocol log when the connection gets disconnected and thus we will verify correctly in the test cases that the connection doesn't get closed prematurely. This is important for example NTLM to work. Documentation added to FILEFORMAT, test 503 updated to use this.
Diffstat (limited to 'tests/server/sws.c')
-rw-r--r--tests/server/sws.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 14369e1d5..21e3bf57a 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -118,6 +118,7 @@ struct httprequest {
bool pipelining; /* true if request is pipelined */
int callcount; /* times ProcessRequest() gets called */
unsigned short connect_port; /* the port number CONNECT used */
+ bool connmon; /* monitor the state of the connection, log disconnects */
};
static int ProcessRequest(struct httprequest *req);
@@ -157,6 +158,11 @@ const char *serverlogfile = DEFAULT_LOGFILE;
/* 'stream' means to send a never-ending stream of data */
#define CMD_STREAM "stream"
+/* 'connection-monitor' will output when a server/proxy connection gets
+ disconnected as for some cases it is important that it gets done at the
+ proper point - like with NTLM */
+#define CMD_CONNECTIONMONITOR "connection-monitor"
+
#define END_OF_HEADERS "\r\n\r\n"
enum {
@@ -437,6 +443,11 @@ static int ProcessRequest(struct httprequest *req)
logmsg("instructed to stream");
req->rcmd = RCMD_STREAM;
}
+ else if(!strncmp(CMD_CONNECTIONMONITOR, cmd,
+ strlen(CMD_CONNECTIONMONITOR))) {
+ logmsg("enabled connection monitoring");
+ req->connmon = TRUE;
+ }
else if(1 == sscanf(cmd, "pipe: %d", &num)) {
logmsg("instructed to allow a pipe size of %d", num);
if(num < 0)
@@ -814,6 +825,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
req->pipelining = FALSE;
req->callcount = 0;
req->connect_port = 0;
+ req->connmon = FALSE;
/*** end of httprequest init ***/
@@ -1960,10 +1972,6 @@ int main(int argc, char *argv[])
if(req.open) {
logmsg("=> persistant connection request ended, awaits new request\n");
- /*
- const char *keepopen="[KEEPING CONNECTION OPEN]";
- storerequest((char *)keepopen, strlen(keepopen));
- */
}
/* if we got a CONNECT, loop and get another request as well! */
} while(req.open || (req.testno == DOCNUMBER_CONNECT));
@@ -1973,6 +1981,11 @@ int main(int argc, char *argv[])
logmsg("====> Client disconnect");
+ if(req.connmon) {
+ const char *keepopen="[DISCONNECT]\n";
+ storerequest((char *)keepopen, strlen(keepopen));
+ }
+
if(!req.open)
/* When instructed to close connection after server-reply we
wait a very small amount of time before doing so. If this