forked from uofa-cmput404/cgi-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.py
More file actions
49 lines (36 loc) · 1.11 KB
/
Copy pathhello.py
File metadata and controls
49 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
import os, pprint
import cgi
import json
# from templates import login_page
# import urllib.parse
# print("Content-Type: text/plain")
# print()
# print(os.environ)
# print("Content-Type: text/html")
# print()
# print(f"<p> QUERY_STRING={os.environ['QUERY_STRING']}</p>")
# print("Content-type: text/html\r\n\r\n")
# print("<font size=+1>Environment</font><\br>")
# for param in os.environ.keys():
# print(os.environ[param])
# print(cgi.print_environ())
# print("alex")
# env_var = os.environ
# pprint.pprint(dict(env_var), width=1)
# print(cgi.print_environ('QUERY_STRING'))
# probably works -> prints none
# print(os.environ.get("QUERY_STRING"))
# print(login_page())
# form = cgi.FieldStorage()
# name = form.getvalue('username')
# print("the name is ", name)
# posted_bytes = os.environ.get("CONTENT_LENGTH",)
# print("posted bytes: ", posted_bytes)
# if posted_bytes:
# posted = sys.stdin.read(int(posted_bytes))
# print("<p> POSTED: <pre>")
# for line in posted.splitlines():
# print(line)
# print("</pre></p>")
# question 5 hardcode username and password to compare?