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.
This commit is contained in:
Родитель
897cf5d117
Коммит
28dc509dde
|
@ -133,6 +133,7 @@ skip: [num] instructs the server to ignore reading this many bytes from a PU
|
|||
rtp: part [num] channel [num] size [num]
|
||||
stream a fake RTP packet for the given part on a chosen channel
|
||||
with the given payload size
|
||||
connection-monitor
|
||||
</servercmd>
|
||||
</reply>
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ multi
|
|||
|
||||
# Server-side
|
||||
<reply>
|
||||
<servercmd>
|
||||
connection-monitor
|
||||
</servercmd>
|
||||
<data>
|
||||
HTTP/1.1 200 OK swsclose
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче