[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 13/18: sws: search for "Testno:" header uncondtionally if no tes
From: |
gnunet |
Subject: |
[gnurl] 13/18: sws: search for "Testno:" header uncondtionally if no testno |
Date: |
Fri, 20 Dec 2019 14:49:15 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 25b69c482f45c7acd817920bd8fdf68887be51a2
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Dec 19 16:45:53 2019 +0100
sws: search for "Testno:" header uncondtionally if no testno
Even if the initial request line wasn't found. With the fix to 1455, the
test number is now detected correctly.
(Problem found when running tests in random order.)
Closes #4744
---
tests/data/test1455 | 3 ++-
tests/server/sws.c | 40 +++++++++++++++++++++++-----------------
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/tests/data/test1455 b/tests/data/test1455
index cbe6fe22e..8483d7bb8 100644
--- a/tests/data/test1455
+++ b/tests/data/test1455
@@ -37,7 +37,7 @@ http
HTTP GET when PROXY Protocol enabled
</name>
<command>
-http://%HOSTIP:%HTTPPORT/1455 --haproxy-protocol
+http://%HOSTIP:%HTTPPORT/1455 --haproxy-protocol -H "Testno: 1455"
</command>
<features>
proxy
@@ -58,6 +58,7 @@ proxy-line
GET /1455 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Testno: 1455
</protocol>
</verify>
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 963357799..c1bbdf7e0 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -367,6 +367,8 @@ static int parse_servercmd(struct httprequest *req)
filename = test2file(req->testno);
req->close = FALSE;
+ req->connmon = FALSE;
+
stream = fopen(filename, "rb");
if(!stream) {
error = errno;
@@ -391,8 +393,6 @@ static int parse_servercmd(struct httprequest *req)
return 1; /* done */
}
- req->connmon = FALSE;
-
cmd = orgcmd;
while(cmd && cmdsize) {
char *check;
@@ -540,12 +540,11 @@ static int ProcessRequest(struct httprequest *req)
msnprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
req->testno, req->partno);
logmsg("%s", logbuf);
-
- /* find and parse <servercmd> for this test */
- parse_servercmd(req);
}
- else
+ else {
+ logmsg("No test number");
req->testno = DOCNUMBER_NOTHING;
+ }
}
@@ -605,14 +604,6 @@ static int ProcessRequest(struct httprequest *req)
}
}
- if(req->testno == DOCNUMBER_NOTHING) {
- /* check for a Testno: header with the test case number */
- char *testno = strstr(line, "\nTestno: ");
- if(testno) {
- req->testno = strtol(&testno[9], NULL, 10);
- logmsg("Found test number %d in Testno: header!", req->testno);
- }
- }
if(req->testno == DOCNUMBER_NOTHING) {
/* Still no test case number. Try to get the the number off the last dot
instead, IE we consider the TLD to be the test number. Test 123 can
@@ -653,8 +644,8 @@ static int ProcessRequest(struct httprequest *req)
}
}
else if((req->offset >= 3) && (req->testno == DOCNUMBER_NOTHING)) {
- logmsg("** Unusual request. Starts with %02x %02x %02x",
- line[0], line[1], line[2]);
+ logmsg("** Unusual request. Starts with %02x %02x %02x (%c%c%c)",
+ line[0], line[1], line[2], line[0], line[1], line[2]);
}
if(!end) {
@@ -662,7 +653,22 @@ static int ProcessRequest(struct httprequest *req)
logmsg("request not complete yet");
return 0; /* not complete yet */
}
- logmsg("- request found to be complete");
+ logmsg("- request found to be complete (%d)", req->testno);
+
+ if(req->testno == DOCNUMBER_NOTHING) {
+ /* check for a Testno: header with the test case number */
+ char *testno = strstr(line, "\nTestno: ");
+ if(testno) {
+ req->testno = strtol(&testno[9], NULL, 10);
+ logmsg("Found test number %d in Testno: header!", req->testno);
+ }
+ else {
+ logmsg("No Testno: header");
+ }
+ }
+
+ /* find and parse <servercmd> for this test */
+ parse_servercmd(req);
if(use_gopher) {
/* when using gopher we cannot check the request until the entire
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 10/18: curl.h: add two defines for the "pre ISO C" case, (continued)
- [gnurl] 10/18: curl.h: add two defines for the "pre ISO C" case, gnunet, 2019/12/20
- [gnurl] 02/18: test1270: a basic -w redirect_url test, gnunet, 2019/12/20
- [gnurl] 06/18: strerror: Fix compiler warning "empty expression", gnunet, 2019/12/20
- [gnurl] 07/18: CURLOPT_QUOTE.3: fix typos, gnunet, 2019/12/20
- [gnurl] 08/18: test1456: remove the use of a fixed local port, gnunet, 2019/12/20
- [gnurl] 05/18: curl/parseconfig: use curl_free() to free memory allocated by libcurl, gnunet, 2019/12/20
- [gnurl] 04/18: curl/parseconfig: fix mem-leak, gnunet, 2019/12/20
- [gnurl] 09/18: create_conn: prefer multiplexing to using new connections, gnunet, 2019/12/20
- [gnurl] 16/18: HISTORY: OSS-Fuzz started fuzzing libcurl in 2017, gnunet, 2019/12/20
- [gnurl] 11/18: test165: set LC_ALL=en_US.UTF-8 too, gnunet, 2019/12/20
- [gnurl] 13/18: sws: search for "Testno:" header uncondtionally if no testno,
gnunet <=
- [gnurl] 17/18: examples/url2file.c: corrected a comment, gnunet, 2019/12/20
- [gnurl] 12/18: tests: set LC_ALL in more tests, gnunet, 2019/12/20
- [gnurl] 14/18: ngtcp2: Support the latest update key callback type, gnunet, 2019/12/20
- [gnurl] 15/18: RELEASE-NOTES: synced, gnunet, 2019/12/20
- [gnurl] 18/18: Merge branch 'master' of https://github.com/curl/curl, gnunet, 2019/12/20