From 7eedf9dab94b97c075f24348d1e88cdca0399f0d Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Thu, 11 Mar 2021 21:42:19 -0600 Subject: Finish hw4 --- csci4131/hw4/strap012/strap012.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'csci4131/hw4/strap012') diff --git a/csci4131/hw4/strap012/strap012.py b/csci4131/hw4/strap012/strap012.py index ec0ecc3..31668af 100644 --- a/csci4131/hw4/strap012/strap012.py +++ b/csci4131/hw4/strap012/strap012.py @@ -22,6 +22,7 @@ def check_perms(resource): stmode = os.stat(resource).st_mode return(getattr(stat, 'S_IROTH') & stmode) > 0 +# Puts together the HTML for the POST form return def POST(form): form = unquote(form) form = form.replace("+", " ").split("&") @@ -32,9 +33,9 @@ def POST(form): x = x.split("=") contents = contents + "\n" + x[0] + "\n" + x[1] + "\n\n" table = "" + contents + "
" - ret = "\n\n\n\n\nTest\n\n\n

\nFollowing Form Data Submitted Successfully:


\n{}\n\n".format(table) + ret = "\n\n\n\n\nTest\n\n\n

\nFollowing Form Data Submitted Successfully:


\n{}\n\n".format(table) return ret - +#For Content Type def getType(type): if type == "html": return "text/html" @@ -54,7 +55,7 @@ def getType(type): def getContents(type, file, contents): if type =="POST": return b"".join( - [OK.encode(), "{}".format(CRLF), POST(contents).encode(), "{}{}".format(CRLF, CRLF).encode()]) + [OK.encode(), "{}".format(CRLF).encode(), POST(contents).encode(), "{}{}".format(CRLF, CRLF).encode()]) returnValue = "".encode() try: if file.split("?")[0] == "redirect": -- cgit v1.2.3