more script tests

+ add cgi checks for error in script output
+ fix script_path relative to absolute
+ cgi makefile more efficient
This commit is contained in:
Hugo LAMY
2022-08-16 18:24:49 +02:00
parent ff443c80b1
commit 1ed4128afc
21 changed files with 485 additions and 109 deletions

View File

@@ -18,7 +18,6 @@
form {
display: flex;
flex-direction: column;
border: 1px solid red;
margin: 20px;
padding: 5px;
}
@@ -29,10 +28,31 @@
mark {
margin: 0px 3px;
}
#get form {
border: 1px solid red;
}
#post form {
border: 1px solid green;
}
</style>
</head>
<body>
<!--
. cgi_cpp.cpp
cgi_cpp_bad_headers.cpp
cgi_cpp_empty.cpp
. cgi_cpp_empty_lines.cpp
. cgi_cpp_len.cpp
. cgi_cpp_len_big.cpp
. cgi_cpp_len_small.cpp
. cgi_cpp_no_body.cpp
cgi_cpp_no_headers.cpp
cgi_cpp_only_crlf.cpp
. cgi_cpp_sleep.cpp
. cgi_cpp_status.cpp
-->
<div id="get">
<form method="get" action="/cgi-bin/cgi_cpp.out">
<p><mark>get</mark> form</p>
@@ -42,6 +62,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -53,6 +75,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -64,6 +88,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -75,6 +101,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -151,6 +179,100 @@
<option value="511">511</option>
</select>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>depend on status code</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_empty_lines.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_empty_lines.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_sleep.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_sleep.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>the request will sleep for one minute</p>
<p>but other request chould not be blocked</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_no_body.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_no_body.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>blank page</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_bad_headers.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_bad_headers.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_empty.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_empty.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_no_headers.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_no_headers.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
<br>
<form method="get" action="/cgi-bin/cgi_cpp_only_crlf.out">
<p><mark>get</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_only_crlf.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
</div>
@@ -163,6 +285,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -174,6 +298,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -185,6 +311,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -196,6 +324,8 @@
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
@@ -272,6 +402,100 @@
<option value="511">511</option>
</select>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>depend on status code</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_empty_lines.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_empty_lines.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>normal output</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_sleep.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_sleep.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>the request will sleep for one minute</p>
<p>but other request chould not be blocked</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_no_body.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_no_body.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>blank page</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_bad_headers.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_bad_headers.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_empty.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_empty.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_no_headers.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_no_headers.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
<br>
<form method="post" action="/cgi-bin/cgi_cpp_only_crlf.out">
<p><mark>post</mark> form</p>
<p>to <mark>/cgi-bin/cgi_cpp_only_crlf.out</mark></p>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="submit">
<h3>expectation:</h3>
<p>error 500</p>
</form>
</div>