diff --git a/tests/FILEFORMAT.md b/tests/FILEFORMAT.md index 529bbc019615..5b5f82dea47c 100644 --- a/tests/FILEFORMAT.md +++ b/tests/FILEFORMAT.md @@ -237,10 +237,14 @@ If the data contains `swsclose` anywhere within the start and end tag, and this is an HTTP test, then the connection is closed by the server after this response is sent. If not, the connection is kept persistent. -If the data contains `swsbounce` anywhere within the start and end tag, the -HTTP server detects if this is a second request using the same test and part -number and then increases the part number with one. This is useful for auth -tests and similar. +If the data contains `swsbounce` anywhere within the start and end tag, then +the HTTP server overrides the part number response returned for a subsequent +request made by the same test to `previous part number + 1`. For example, if a +test makes a request which causes the server to return `` that contains +keyword `swsbounce` then for the next response it ignores the requested part +number and instead returns ``. And if `` contains keyword +`swsbounce` then the next response is `` and so on. This is useful for +auth tests and similar. `sendzero=yes` means that the (FTP) server "sends" the data even if the size is zero bytes. Used to verify curl's behavior on zero bytes transfers. diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index f39a30f466c4..43c30d5e3fa2 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -268,6 +268,7 @@ test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 \ test3008 test3009 test3010 test3011 test3012 test3013 test3014 test3015 \ test3016 test3017 test3018 test3019 test3020 test3021 test3022 test3023 \ test3024 test3025 test3026 test3027 test3028 test3029 test3030 test3031 \ +test3032 \ \ test3100 test3101 test3102 test3103 test3104 test3105 \ test3200 \ diff --git a/tests/data/test1001 b/tests/data/test1001 index 4220ab6759ef..63eb072fdccc 100644 --- a/tests/data/test1001 +++ b/tests/data/test1001 @@ -19,7 +19,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -41,7 +41,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test1002 b/tests/data/test1002 index 92cb5e158532..50f7dcf2a82c 100644 --- a/tests/data/test1002 +++ b/tests/data/test1002 @@ -18,7 +18,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -40,7 +40,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test1060 b/tests/data/test1060 index c1ad6c66768c..ce7a37ea09d9 100644 --- a/tests/data/test1060 +++ b/tests/data/test1060 @@ -836,7 +836,7 @@ daniel # then this is returned when we get proxy-auth -HTTP/1.1 200 OK swsbounce +HTTP/1.1 200 OK Server: no @@ -847,7 +847,7 @@ Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345" Content-Length: 40000 X-tra-long-header: %repeat[16080 x a]% -HTTP/1.1 200 OK swsbounce +HTTP/1.1 200 OK Server: no HTTP/1.1 200 OK diff --git a/tests/data/test1061 b/tests/data/test1061 index 76241142c92f..0e383598d0e8 100644 --- a/tests/data/test1061 +++ b/tests/data/test1061 @@ -841,7 +841,7 @@ daniel # then this is returned when we get proxy-auth -HTTP/1.1 200 OK swsbounce +HTTP/1.1 200 OK Server: no @@ -852,7 +852,7 @@ Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345" Transfer-Encoding: chunked X-tra-long-header: %repeat[16080 x a]% -HTTP/1.1 200 OK swsbounce +HTTP/1.1 200 OK Server: no HTTP/1.1 200 OK diff --git a/tests/data/test1284 b/tests/data/test1284 index dd2d8b8b7ceb..2900c512efd1 100644 --- a/tests/data/test1284 +++ b/tests/data/test1284 @@ -10,7 +10,7 @@ HTTP Digest auth # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -27,7 +27,7 @@ ok -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test1285 b/tests/data/test1285 index 986cb92cc76c..ee5f13c5e509 100644 --- a/tests/data/test1285 +++ b/tests/data/test1285 @@ -10,7 +10,7 @@ HTTP Digest auth # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -27,7 +27,7 @@ ok -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test1286 b/tests/data/test1286 index df0f35fc5a1b..e898a37d30a6 100644 --- a/tests/data/test1286 +++ b/tests/data/test1286 @@ -11,7 +11,7 @@ followlocation # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", qop="auth" Content-Type: text/html; charset=iso-8859-1 @@ -35,7 +35,7 @@ Content-Length: 0 -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", qop="auth" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test176 b/tests/data/test176 index eba8fef78ce9..0eab979c90c3 100644 --- a/tests/data/test176 +++ b/tests/data/test176 @@ -11,7 +11,7 @@ HTTP NTLM auth # the first request has NTLM type-1 included, and then the 1001 is returned -HTTP/1.1 200 beng swsclose swsbounce +HTTP/1.1 200 beng swsclose Server: Microsoft-IIS/6.0 Authentication-Info: Passport1.4 tname=MSPAuth,tname=MSPProf,tname=MSPConsent,tname=MSPSecAuth Content-Type: text/html; charset=iso-8859-1 @@ -29,7 +29,7 @@ content for you -HTTP/1.1 200 beng swsclose swsbounce +HTTP/1.1 200 beng swsclose Server: Microsoft-IIS/6.0 Authentication-Info: Passport1.4 tname=MSPAuth,tname=MSPProf,tname=MSPConsent,tname=MSPSecAuth Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test2058 b/tests/data/test2058 index 4dfac74b7dc3..c85d534c9a3d 100644 --- a/tests/data/test2058 +++ b/tests/data/test2058 @@ -19,7 +19,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", algorithm="SHA-256", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -41,7 +41,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", algorithm="SHA-256", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test2059 b/tests/data/test2059 index e2957bce5daa..5b924a5847ef 100644 --- a/tests/data/test2059 +++ b/tests/data/test2059 @@ -19,7 +19,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", algorithm="SHA-256", nonce="1053604144", userhash=true Content-Type: text/html; charset=iso-8859-1 @@ -41,7 +41,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", algorithm="SHA-256", nonce="1053604144", userhash=true Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test206 b/tests/data/test206 index 19fbbfb4a50b..60e103d098de 100644 --- a/tests/data/test206 +++ b/tests/data/test206 @@ -41,7 +41,7 @@ daniel # then this is returned when we get proxy-auth -HTTP/1.1 200 OK swsbounce +HTTP/1.1 200 OK Server: no @@ -51,7 +51,7 @@ HTTP/1.1 407 Authorization Required to proxy me my dear Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345" Content-Length: 33 -HTTP/1.1 200 OK swsbounce +HTTP/1.1 200 OK Server: no HTTP/1.1 200 OK diff --git a/tests/data/test2060 b/tests/data/test2060 index e1632a387d64..860f40eb8f44 100644 --- a/tests/data/test2060 +++ b/tests/data/test2060 @@ -19,7 +19,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", algorithm="SHA-512-256", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -41,7 +41,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", algorithm="SHA-512-256", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test2067 b/tests/data/test2067 index 4fdd4dcbb056..a65fb52500a7 100644 --- a/tests/data/test2067 +++ b/tests/data/test2067 @@ -10,7 +10,7 @@ HTTP Digest auth # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", algorithm="SHA-256" Content-Type: text/html; charset=iso-8859-1 @@ -27,7 +27,7 @@ ok -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", algorithm="SHA-256" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test2068 b/tests/data/test2068 index 32afd26290ae..1a6d2713499e 100644 --- a/tests/data/test2068 +++ b/tests/data/test2068 @@ -10,7 +10,7 @@ HTTP Digest auth # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", algorithm="SHA-512-256" Content-Type: text/html; charset=iso-8859-1 @@ -27,7 +27,7 @@ ok -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", algorithm="SHA-512-256" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test2069 b/tests/data/test2069 index 74d719fd3e9d..86aa18301ae3 100644 --- a/tests/data/test2069 +++ b/tests/data/test2069 @@ -10,7 +10,7 @@ HTTP Digest auth # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", algorithm="SHA-256", userhash=true Content-Type: text/html; charset=iso-8859-1 @@ -27,7 +27,7 @@ ok -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", algorithm="SHA-256", userhash=true Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test245 b/tests/data/test245 index 78893f028e45..60319ebc2d3b 100644 --- a/tests/data/test245 +++ b/tests/data/test245 @@ -10,7 +10,7 @@ HTTP Digest auth # Server-side -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -27,7 +27,7 @@ ok -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test246 b/tests/data/test246 index a756028b9c88..67bf446d7489 100644 --- a/tests/data/test246 +++ b/tests/data/test246 @@ -15,7 +15,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 @@ -37,7 +37,7 @@ Server: Microsoft-IIS/5.0 Date: Sun, 03 Apr 2005 14:57:45 GMT X-Powered-By: ASP.NET -HTTP/1.1 401 authentication please swsbounce +HTTP/1.1 401 authentication please Server: Microsoft-IIS/6.0 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144" Content-Type: text/html; charset=iso-8859-1 diff --git a/tests/data/test3032 b/tests/data/test3032 new file mode 100644 index 000000000000..985ff4ff6440 --- /dev/null +++ b/tests/data/test3032 @@ -0,0 +1,112 @@ + + + +HTTP +--location + + + +# Server-side + + + +HTTP/1.1 301 redirect swsbounce +Content-Length: 0 +Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER +Part: data + + + + +HTTP/1.1 301 redirect swsbounce +Content-Length: 0 +Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER +Part: data1 + + + + +HTTP/1.1 301 redirect swsbounce +Content-Length: 0 +Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER +Part: data2 + + + + +HTTP/1.1 200 OK +Content-Type: text/html +Content-Length: 30 +Part: data3 + +XXXXXXXXXXXXXXXXXXXXXXXXXXXXX + + + +HTTP/1.1 301 redirect swsbounce +Content-Length: 0 +Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER +Part: data + +HTTP/1.1 301 redirect swsbounce +Content-Length: 0 +Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER +Part: data1 + +HTTP/1.1 301 redirect swsbounce +Content-Length: 0 +Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER +Part: data2 + +HTTP/1.1 200 OK +Content-Type: text/html +Content-Length: 30 +Part: data3 + +XXXXXXXXXXXXXXXXXXXXXXXXXXXXX + + + + +# Client-side + + +http + +# This is a test of the swsbounce keyword which is used during tests to +# override the data response number for the next request to the previous +# data response number + 1. eg data, data1, data2 etc. + +HTTP redirect loop 3x swsbounce test + + +--location http://%HOSTIP:%HTTPPORT/%TESTNUMBER + + + +# Verify data after the test has been "shot" + + +GET /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + +GET /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + +GET /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + +GET /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* + + + + diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index 73cddcf09801..707d20706eaf 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -72,9 +72,9 @@ static int serverlogslocked = 0; static long prevtestno = -1; /* previous test number we served */ static long prevpartno = -1; /* previous part number we served */ -static bool prevbounce = FALSE; /* instructs the server to increase the part - number for a test in case the identical - testno+partno request shows up again */ +static bool prevbounce = FALSE; /* instructs the server to override the + requested part number to prevpartno + 1 when + prevtestno and current test are the same */ #define RCMD_NORMALREQ 0 /* default request, use the tests file normally */ #define RCMD_IDLE 1 /* told to sit idle */ @@ -1319,9 +1319,8 @@ int main(int argc, char *argv[]) if(prevbounce) { /* bounce treatment requested */ - if((req.testno == prevtestno) && - (req.partno == prevpartno)) { - req.partno++; + if(req.testno == prevtestno) { + req.partno = prevpartno + 1; logmsg("BOUNCE part number to %ld", req.partno); } else { diff --git a/tests/server/sws.c b/tests/server/sws.c index 9e364d1d683a..e6aefe3e94d0 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -84,9 +84,9 @@ static bool is_proxy = FALSE; static long prevtestno = -1; /* previous test number we served */ static long prevpartno = -1; /* previous part number we served */ -static bool prevbounce = FALSE; /* instructs the server to increase the part - number for a test in case the identical - testno+partno request shows up again */ +static bool prevbounce = FALSE; /* instructs the server to override the + requested part number to prevpartno + 1 when + prevtestno and current test are the same */ #define RCMD_NORMALREQ 0 /* default request, use the tests file normally */ #define RCMD_IDLE 1 /* told to sit idle */ @@ -1982,9 +1982,8 @@ static int service_connection(curl_socket_t msgsock, struct httprequest *req, if(prevbounce) { /* bounce treatment requested */ - if((req->testno == prevtestno) && - (req->partno == prevpartno)) { - req->partno++; + if(req->testno == prevtestno) { + req->partno = prevpartno + 1; logmsg("BOUNCE part number to %ld", req->partno); } else {