summaryrefslogtreecommitdiff
path: root/tests/server/sws.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-06-04 22:50:58 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-06-04 22:50:58 +0200
commita7452b8b8c824e4227372a21a0517d34c8185f85 (patch)
treeb2732c18d03956f53a1e8bd1086b68d6f31251cc /tests/server/sws.c
parent0bf5ce77aabe7307e41db13a0d03a63517fdc366 (diff)
downloadcurl-a7452b8b8c824e4227372a21a0517d34c8185f85.tar.gz
sws: support extracting test number from CONNECT ipv6-address!
If an ipv6-address is provided to CONNECT, the last hexadecimal group in the address will be used as the test number! For example the address "[1234::ff]" would be treated as test case 255.
Diffstat (limited to 'tests/server/sws.c')
-rw-r--r--tests/server/sws.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 7e1c44012..38658cb74 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -518,6 +518,7 @@ static int ProcessRequest(struct httprequest *req)
if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d",
doc, &prot_major, &prot_minor) == 3) {
char *portp = NULL;
+ unsigned long part=0;
sprintf(logbuf, "Received a CONNECT %s HTTP/%d.%d request",
doc, prot_major, prot_minor);
@@ -530,14 +531,24 @@ static int ProcessRequest(struct httprequest *req)
if(doc[0] == '[') {
char *p = &doc[1];
- while(*p && (ISXDIGIT(*p) || (*p == ':') || (*p == '.')))
- p++;
+ /* scan through the hexgroups and store the value of the last group
+ in the 'part' variable and use as test case number!! */
+ while(*p && (ISXDIGIT(*p) || (*p == ':') || (*p == '.'))) {
+ char *endp;
+ part = strtoul(p, &endp, 16);
+ if(ISXDIGIT(*p))
+ p = endp;
+ else
+ p++;
+ }
if(*p != ']')
logmsg("Invalid CONNECT IPv6 address format");
else if (*(p+1) != ':')
logmsg("Invalid CONNECT IPv6 port format");
else
portp = p+1;
+
+ req->testno = part;
}
else
portp = strchr(doc, ':');
@@ -548,7 +559,10 @@ static int ProcessRequest(struct httprequest *req)
logmsg("Invalid CONNECT port received");
else
req->connect_port = curlx_ultous(ulnum);
+
}
+ logmsg("Port number: %d, test case number: %ld",
+ req->connect_port, req->testno);
}
}