If a HTTP request is Basic and num is already >=1000, the HTTP test server
authorDan Fandrich <dan@coneharvesters.com>
Tue, 25 Nov 2008 23:23:47 +0000 (23:23 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 25 Nov 2008 23:23:47 +0000 (23:23 +0000)
adds 1 to num to get the data section to return. This allows testing
authentication negotiations using the Basic authentication method.

tests/FILEFORMAT
tests/server/sws.c

index 35bb789..a1d82bf 100644 (file)
@@ -67,6 +67,13 @@ of [test case number]%10000.
 B) The request was HTTP and included digest details, which adds 1000 to NUM
 C) If a HTTP request is NTLM type-1, it adds 1001 to num
 D) If a HTTP request is NTLM type-3, it adds 1002 to num
+E) If a HTTP request is Basic and num is already >=1000, it adds 1 to num
+
+Dynamically changing num in this way allows the test harness to be used to
+test authentication negotiation where several different requests must be sent
+to complete a transfer. The response to each request is found in its own data
+section.  Validating the entire negotiation sequence can be done by
+specifying a datacheck section.
 </dataNUM>
 <datacheck [nonewline="yes"]>
 if the data is sent but this is what should be checked afterwards. If
index 3f11b3b..5e3f3ab 100644 (file)
@@ -442,6 +442,13 @@ static int ProcessRequest(struct httprequest *req)
     req->ntlm = TRUE; /* NTLM found */
     logmsg("Received NTLM type-1, sending back data %ld", req->partno);
   }
+  else if((req->partno >= 1000) && strstr(req->reqbuf, "Authorization: Basic")) {
+    /* If the client is passing this Basic-header and the part number is already
+       >=1000, we add 1 to the part number.  This allows simple Basic authentication
+       negotiation to work in the test suite. */
+    req->partno += 1;
+    logmsg("Received Basic request, sending back data %ld", req->partno);
+  }
   if(strstr(req->reqbuf, "Connection: close"))
     req->open = FALSE; /* close connection after this request */