bpo-47061: deprecate cgi and cgitb (GH-32410)

Part of PEP 594.
This commit is contained in:
Brett Cannon 2022-04-08 17:15:35 -07:00 committed by GitHub
parent 1c8b3b5d66
commit cd29bd13ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 7 deletions

View file

@ -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 = """\