diff options
| author | Brett Cannon <brett@python.org> | 2022-04-09 00:15:35 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-09 00:15:35 (GMT) |
| commit | cd29bd13ef1fe18970c5d43b66c545dd03117cb9 (patch) | |
| tree | cc111c2bf79956a6a8680f53500662cb2511081b /Lib/test/test_httpservers.py | |
| parent | 1c8b3b5d66a629258f1db16939b996264a8b9c37 (diff) | |
| download | cpython-cd29bd13ef1fe18970c5d43b66c545dd03117cb9.zip cpython-cd29bd13ef1fe18970c5d43b66c545dd03117cb9.tar.gz cpython-cd29bd13ef1fe18970c5d43b66c545dd03117cb9.tar.bz2 | |
bpo-47061: deprecate cgi and cgitb (GH-32410)
Part of PEP 594.
Diffstat (limited to 'Lib/test/test_httpservers.py')
| -rw-r--r-- | Lib/test/test_httpservers.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index d20b45e..1f041aa 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -570,14 +570,19 @@ print("Hello World") cgi_file2 = """\ #!%s -import cgi +import os +import sys +import urllib.parse print("Content-type: text/html") print() -form = cgi.FieldStorage() -print("%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"), - form.getfirst("bacon"))) +content_length = int(os.environ["CONTENT_LENGTH"]) +query_string = sys.stdin.buffer.read(content_length) +params = {key.decode("utf-8"): val.decode("utf-8") + for key, val in urllib.parse.parse_qsl(query_string)} + +print("%%s, %%s, %%s" %% (params["spam"], params["eggs"], params["bacon"])) """ cgi_file4 = """\ |
