summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcgi-bin/and-then-js.cgi3
-rwxr-xr-xcgi-bin/auth.cgi7
-rwxr-xr-xcgi-bin/cookies.cgi7
-rwxr-xr-xcgi-bin/env.cgi3
-rwxr-xr-xcgi-bin/image.cgi7
-rwxr-xr-xcgi-bin/monkey-index.cgi2
-rwxr-xr-xcgi-bin/ordered-list.cgi74
-rwxr-xr-xcgi-bin/sleep.cgi7
-rw-r--r--html/form-kitchensink.html123
-rw-r--r--monkey-test/ns-infrastructure/index.yaml3
-rw-r--r--monkey-test/ns-infrastructure/list-style.yaml93
-rw-r--r--monkey-test/short-internet/https-badssl-oddcert.yaml.skip (renamed from monkey-test/short-internet/https-badssl-oddcert.yaml)0
12 files changed, 306 insertions, 23 deletions
diff --git a/cgi-bin/and-then-js.cgi b/cgi-bin/and-then-js.cgi
index 6c03589..dc26ed3 100755
--- a/cgi-bin/and-then-js.cgi
+++ b/cgi-bin/and-then-js.cgi
@@ -1,5 +1,6 @@
#!/usr/bin/python3
+from urllib.parse import parse_qs
import cgi
import cgitb
import os
@@ -7,7 +8,7 @@ import time
cgitb.enable()
-qs = cgi.parse_qs(os.getenv("QUERY_STRING", "t=1&val=async-cb-adds-timeout"))
+qs = parse_qs(os.getenv("QUERY_STRING", "t=1&val=async-cb-adds-timeout"))
content = qs.get("val", ["async-cb-adds-timeout"])[0]
diff --git a/cgi-bin/auth.cgi b/cgi-bin/auth.cgi
index 5eebf4e..3f49135 100755
--- a/cgi-bin/auth.cgi
+++ b/cgi-bin/auth.cgi
@@ -1,16 +1,13 @@
#!/usr/bin/python3
-import cgi
-import cgitb
-cgitb.enable()
-
import os
+from urllib.parse import parse_qs
from base64 import b64decode
auth = os.getenv("HTTP_AUTHORIZATION")
query = os.getenv("QUERY_STRING") or "user=foo&pass=bar&realm=NetSurf+Authentication+Test"
-query = cgi.parse_qs(query)
+query = parse_qs(query)
username = query.get("user", ["foo"])[0]
password = query.get("pass", query.get("password", ["bar"]))[0]
realm = query.get("realm", ["NetSurf Authentication Test"])[0]
diff --git a/cgi-bin/cookies.cgi b/cgi-bin/cookies.cgi
index be12589..96d9d25 100755
--- a/cgi-bin/cookies.cgi
+++ b/cgi-bin/cookies.cgi
@@ -1,13 +1,10 @@
#!/usr/bin/python3
-import cgi
-import cgitb
import os
import sys
import io
import json
-
-cgitb.enable()
+from html import escape as html_escape
print("Content-Type: text/html")
print("")
@@ -28,7 +25,7 @@ print("""
""")
for k, v in cookies.items():
- print(" <li>{}: {}</li>".format(cgi.escape(k), cgi.escape(v)))
+ print(" <li>{}: {}</li>".format(html_escape(k), html_escape(v)))
print("""
</ul>
<hr />
diff --git a/cgi-bin/env.cgi b/cgi-bin/env.cgi
index ffd6785..dc02349 100755
--- a/cgi-bin/env.cgi
+++ b/cgi-bin/env.cgi
@@ -1,5 +1,6 @@
#!/usr/bin/python3
+from urllib.parse import parse_qs
import cgi
import cgitb
import os
@@ -33,7 +34,7 @@ for k in sorted(os.environ.keys()):
print("ENV:{}:{}".format(k, os.environ[k]))
if "QUERY_STRING" in os.environ:
- qs = cgi.parse_qs(os.getenv("QUERY_STRING"))
+ qs = parse_qs(os.getenv("QUERY_STRING"))
for k, vs in qs.items():
for i, v in enumerate(vs):
if len(vs) > 1:
diff --git a/cgi-bin/image.cgi b/cgi-bin/image.cgi
index edcca1e..429851e 100755
--- a/cgi-bin/image.cgi
+++ b/cgi-bin/image.cgi
@@ -1,17 +1,14 @@
#!/usr/bin/python3
-import cgi
-import cgitb
+from urllib.parse import parse_qs
import sys
-cgitb.enable()
-
import os
from io import BytesIO
auth = os.getenv("HTTP_AUTHORIZATION")
query = os.getenv("QUERY_STRING") or ""
-query = cgi.parse_qs(query)
+query = parse_qs(query)
width = query.get("width", ["100"])[0]
height = query.get("height", ["100"])[0]
diff --git a/cgi-bin/monkey-index.cgi b/cgi-bin/monkey-index.cgi
index 4ae41f6..3ccb313 100755
--- a/cgi-bin/monkey-index.cgi
+++ b/cgi-bin/monkey-index.cgi
@@ -48,7 +48,7 @@ def main():
# load all test plan yaml files
for fname in sorted(flist):
- with open(os.path.join(testroot, fname), "r") as file_handle:
+ with open(os.path.join(testroot, fname), "rt", encoding='utf8') as file_handle:
files[fname] = yaml.load(file_handle, Loader=yaml.CSafeLoader)
if division + '/index.yaml' not in files:
diff --git a/cgi-bin/ordered-list.cgi b/cgi-bin/ordered-list.cgi
new file mode 100755
index 0000000..838e81d
--- /dev/null
+++ b/cgi-bin/ordered-list.cgi
@@ -0,0 +1,74 @@
+#!/usr/bin/python3
+
+'''
+NetSurf test ordered list generator
+
+The liststyle form parameter may be given to select different list style types.
+'''
+
+import os
+import re
+import cgi
+import cgitb
+
+cgitb.enable()
+
+def main():
+ '''
+ The test plan generator
+ '''
+ docroot = os.environ["DOCUMENT_ROOT"]
+
+ testroot = os.path.join(docroot, "monkey-test")
+
+ params = cgi.FieldStorage()
+
+ liststyle = 'decimal'
+ listcount = 1000
+ liststart = 1
+ listreverse = 0
+
+ # get cgi parameters
+ if 'liststyle' in params and re.match('^[A-Za-z0-9-]+$', params['liststyle'].value):
+ liststyle = params['liststyle'].value
+
+ if 'listcount' in params and re.match('^[0-9]+$', params['listcount'].value):
+ listcount = int(params['listcount'].value)
+
+ if 'liststart' in params and re.match('^[0-9-]+$', params['liststart'].value):
+ liststart = int(params['liststart'].value)
+
+ if 'listreverse' in params and re.match('^[0-1]+$', params['listreverse'].value):
+ listreverse = int(params['listreverse'].value)
+
+ # ensure count is reasonable
+ if listcount > 100000:
+ listcount = 100000
+
+ print('Content-Type: text/html')
+ print('')
+
+ print('<!DOCTYPE html>')
+ print('<html>')
+ print('<head>')
+ print('<style>')
+ print('ol.a {list-style-type:',liststyle,';}')
+ print('</style>')
+ print('</head>')
+ print('<body>')
+ print('<h1>ordered list marker test with',liststyle,'style</h1>')
+ print('<ol class="a"', end='')
+ if liststart != 1:
+ print(' start="{}"'.format(liststart), end='')
+ if listreverse != 0:
+ print(' reversed', end='')
+ print('>')
+ for num in range(liststart, (liststart + listcount)):
+ print('<li>',num,'</li>', sep="")
+
+ print('</ol>')
+ print('</body>')
+ print('</html>')
+
+if __name__ == "__main__":
+ main()
diff --git a/cgi-bin/sleep.cgi b/cgi-bin/sleep.cgi
index 87c017c..270d3bc 100755
--- a/cgi-bin/sleep.cgi
+++ b/cgi-bin/sleep.cgi
@@ -1,13 +1,10 @@
#!/usr/bin/python3
-import cgi
-import cgitb
+from urllib.parse import parse_qs
import os
import time
-cgitb.enable()
-
-qs = cgi.parse_qs(os.getenv("QUERY_STRING", "t=10&ct=text/javascript"))
+qs = parse_qs(os.getenv("QUERY_STRING", "t=10&ct=text/javascript"))
content_type = qs.get("ct", ["text/javascript"])[0]
diff --git a/html/form-kitchensink.html b/html/form-kitchensink.html
new file mode 100644
index 0000000..d68ff95
--- /dev/null
+++ b/html/form-kitchensink.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Forms with everything</title>
+ </head>
+ <body>
+ <h1>Forms with everything</h1>
+ <!-- button fieldset input object output select textarea -->
+ <h2>Post form</h2>
+ <form action="https://test.netsurf-browser.org/cgi-bin/env.cgi" method="post">
+ <h3>button</h3>
+ <p><button>post missing type</button></p>
+ <p><button type="junk">post Junk</button></p>
+ <p><button type="submit" value="pbuttonnoname">post Submit noname</button></p>
+ <p><button type="submit" name="pbutton" value="pbuttonsub">post Submit</button></p>
+ <p><button type="reset">post Reset</button></p>
+ <p><button type="button">post Button</button></p>
+
+ <h3>fieldset</h3>
+ <fieldset>
+ <legend>Fieldset</legend>
+ <p><button type="submit" name="pfieldsetbutton" value="pfieldsetbuttonsub">post fieldset submit</button></p>
+ <p><input type="submit" name="pfieldsetinputbutton" value="post fieldset input button"></p>
+ <p><textarea name="pfieldsettextarea">post fieldset textarea</textarea></p>
+ </fieldset>
+
+ <h3>input</h3>
+ <p><input type="hidden" name="pinputhidden" value="post input hidden"></p>
+ <p><input type="text" name="pinputtext" value="post input text"></p>
+ <p><input type="search" name="pinputsearch" value="post input search"></p>
+ <p><input type="tel" name="pinputtel" value="post input tel"></p>
+ <p><input type="url" name="pinputurl" value="http://www.netsurf-browser.org/"></p>
+ <p><input type="email" name="pinputemail" value="support@netsurf-browser.org"></p>
+ <p><input type="password" name="pinputpassword" value="post input password"></p>
+ <p><input type="date" name="pinputdate" value="2020-12-28"></p>
+ <p><input type="month" name="pinputmonth" value="2020-05"></p>
+ <p><input type="week" name="pinputweek" value="2020-W22"></p>
+ <p><input type="time" name="pinputtime" value="12:34"></p>
+ <p><input type="datetime-local" name="pinputdatetime-local" value="2020-05-25T10:33"></p>
+ <p><input type="number" name="pinputnumber" value="42"></p>
+ <p><input type="range" name="pinputrange" value="33"></p>
+ <p><input type="color" name="pinputcolor" value="#123456"></p>
+ <p><input type="checkbox" name="pinputcheckbox" value="post input checkbox"></p>
+ <p><input type="radio" name="pinputradio" value="post input radio"></p>
+ <p><input type="file" name="pinputfile" value="post input file"></p>
+ <p><input type="submit" name="pinputbutton" value="post input submit"></p>
+ <p><input type="image" name="pinputimage" value="post input image"></p>
+ <p><input type="reset" name="pinputreset" value="post input reset"></p>
+ <p><input type="button" name="pinputbutton" value="post input button"></p>
+
+ <h3>select</h3>
+ <select name="pselect" required>
+ <option value=""> Select value </option>
+ <option value="1"> One </option>
+ <option value="2"> Two </option>
+ <option value="3"> Three </option>
+ <option value="4"> Four </option>
+ <option value="5"> Five </option>
+ </select>
+
+ <h3>textarea</h3>
+ <textarea name="ptextarea">0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789</textarea>
+ </form>
+
+ <h2>Get form</h2>
+ <form action="https://test.netsurf-browser.org/cgi-bin/env.cgi" method="get">
+ <h3>button</h3>
+ <p><button>get missing type</button></p>
+ <p><button type="junk">get Junk</button></p>
+ <p><button type="submit" value="gbuttonnoname">get Submit noname</button></p>
+ <p><button type="submit" name="gbutton" value="gbuttonsub">get Submit</button></p>
+ <p><button type="reset">get Reset</button></p>
+ <p><button type="button">get Button</button></p>
+
+ <h3>fieldset</h3>
+ <fieldset>
+ <legend>Fieldset</legend>
+ <p><button type="submit" name="gfieldsetbutton" value="gfieldsetbuttonsub">get fieldset submit</button></p>
+ <p><input type="submit" name="gfieldsetinputbutton" value="get fieldset input button"></p>
+ <p><textarea name="gfieldsettextarea">get fieldset textarea</textarea></p>
+ </fieldset>
+
+ <h3>input</h3>
+ <p><input type="hidden" name="ginputhidden" value="get input hidden"></p>
+ <p><input type="text" name="ginputtext" value="get input text"></p>
+ <p><input type="search" name="ginputsearch" value="get input search"></p>
+ <p><input type="tel" name="ginputtel" value="get input tel"></p>
+ <p><input type="url" name="ginputurl" value="http://www.netsurf-browser.org/"></p>
+ <p><input type="email" name="ginputemail" value="support@netsurf-browser.org"></p>
+ <p><input type="password" name="ginputpassword" value="get input password"></p>
+ <p><input type="date" name="ginputdate" value="2020-12-28"></p>
+ <p><input type="month" name="ginputmonth" value="2020-05"></p>
+ <p><input type="week" name="ginputweek" value="2020-W22"></p>
+ <p><input type="time" name="ginputtime" value="12:34"></p>
+ <p><input type="datetime-local" name="ginputdatetime-local" value="2020-05-25T10:33"></p>
+ <p><input type="number" name="ginputnumber" value="42"></p>
+ <p><input type="range" name="ginputrange" value="33"></p>
+ <p><input type="color" name="ginputcolor" value="#123456"></p>
+ <p><input type="checkbox" name="ginputcheckbox" value="get input checkbox"></p>
+ <p><input type="radio" name="ginputradio" value="get input radio"></p>
+ <p><input type="file" name="ginputfile" value="get input file"></p>
+ <p><input type="submit" name="ginputbutton" value="get input submit"></p>
+ <p><input type="image" name="ginputimage" value="get input image"></p>
+ <p><input type="reset" name="ginputreset" value="get input reset"></p>
+ <p><input type="button" name="ginputbutton" value="get input button"></p>
+
+ <h3>select</h3>
+ <select name="gselect" required>
+ <option value=""> Select value </option>
+ <option value="1"> One </option>
+ <option value="2"> Two </option>
+ <option value="3"> Three </option>
+ <option value="4"> Four </option>
+ <option value="5"> Five </option>
+ </select>
+
+ <h3>textarea</h3>
+ <textarea name="gtextarea">0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789</textarea>
+ </form>
+ </body>
+</html>
diff --git a/monkey-test/ns-infrastructure/index.yaml b/monkey-test/ns-infrastructure/index.yaml
index eb4612e..3b3070e 100644
--- a/monkey-test/ns-infrastructure/index.yaml
+++ b/monkey-test/ns-infrastructure/index.yaml
@@ -15,3 +15,6 @@
- group: jquery
description: Basic jQuery tests
+
+- group: list-style
+ description: Test list styles
diff --git a/monkey-test/ns-infrastructure/list-style.yaml b/monkey-test/ns-infrastructure/list-style.yaml
new file mode 100644
index 0000000..79e1fa7
--- /dev/null
+++ b/monkey-test/ns-infrastructure/list-style.yaml
@@ -0,0 +1,93 @@
+title: Test list styling
+group: list-style
+steps:
+- action: launch
+ language: en
+- action: window-new
+ tag: win1
+- action: navigate
+ window: win1
+ url: https://test.netsurf-browser.org/cgi-bin/ordered-list.cgi?liststyle=decimal&listcount=10000
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ area: extent
+ checks:
+ - text-contains: "1 1."
+ - text-contains: "9999 9999."
+- action: navigate
+ window: win1
+ url: https://test.netsurf-browser.org/cgi-bin/ordered-list.cgi?liststyle=lower-roman&listcount=10000
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ area: extent
+ checks:
+ - text-contains: "1 i."
+ - text-contains: "3999 mmmcmxcix."
+ - text-contains: "4000 4000."
+ - text-contains: "9999 9999."
+- action: navigate
+ window: win1
+ url: https://test.netsurf-browser.org/cgi-bin/ordered-list.cgi?liststyle=upper-roman&listcount=10000
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ area: extent
+ checks:
+ - text-contains: "1 I."
+ - text-contains: "3999 MMMCMXCIX."
+ - text-contains: "4000 4000."
+ - text-contains: "9999 9999."
+- action: navigate
+ window: win1
+ url: https://test.netsurf-browser.org/cgi-bin/ordered-list.cgi?liststyle=lower-alpha&listcount=10000
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ area: extent
+ checks:
+ - text-contains: "1 a."
+ - text-contains: "9999 nto."
+- action: navigate
+ window: win1
+ url: https://test.netsurf-browser.org/cgi-bin/ordered-list.cgi?liststyle=upper-alpha&listcount=10000
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ area: extent
+ checks:
+ - text-contains: "1 A."
+ - text-contains: "9999 NTO."
+- action: navigate
+ window: win1
+ url: https://test.netsurf-browser.org/cgi-bin/ordered-list.cgi?liststyle=lower-greek&listcount=10000
+- action: block
+ conditions:
+ - window: win1
+ status: complete
+- action: plot-check
+ window: win1
+ area: extent
+ checks:
+ - text-contains: "1 α."
+ - text-contains: "9999 ρθο."
+- action: window-close
+ window: win1
+- action: quit
+
diff --git a/monkey-test/short-internet/https-badssl-oddcert.yaml b/monkey-test/short-internet/https-badssl-oddcert.yaml.skip
index 1c26357..1c26357 100644
--- a/monkey-test/short-internet/https-badssl-oddcert.yaml
+++ b/monkey-test/short-internet/https-badssl-oddcert.yaml.skip