diff options
author | RossTheRoss <mstrapp@protonmail.com> | 2021-03-08 10:52:40 -0600 |
---|---|---|
committer | RossTheRoss <mstrapp@protonmail.com> | 2021-03-08 10:52:40 -0600 |
commit | 35dff751703f30904b5260889c19940bcd98795d (patch) | |
tree | ee43f673e1ba25b296ebca1ea6d104550f3eba2b /csci4131/hw4/strap012 | |
parent | aaa (diff) | |
download | homework-35dff751703f30904b5260889c19940bcd98795d.tar homework-35dff751703f30904b5260889c19940bcd98795d.tar.gz homework-35dff751703f30904b5260889c19940bcd98795d.tar.bz2 homework-35dff751703f30904b5260889c19940bcd98795d.tar.lz homework-35dff751703f30904b5260889c19940bcd98795d.tar.xz homework-35dff751703f30904b5260889c19940bcd98795d.tar.zst homework-35dff751703f30904b5260889c19940bcd98795d.zip |
fix form
Diffstat (limited to 'csci4131/hw4/strap012')
-rw-r--r-- | csci4131/hw4/strap012/MyForm.html | 2 | ||||
-rw-r--r-- | csci4131/hw4/strap012/strap012.py | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/csci4131/hw4/strap012/MyForm.html b/csci4131/hw4/strap012/MyForm.html index 435965b..4000667 100644 --- a/csci4131/hw4/strap012/MyForm.html +++ b/csci4131/hw4/strap012/MyForm.html @@ -19,7 +19,7 @@ </table> </nav><br> <h2>Simple Form</h2> - <form action="http://www-users.cselabs.umn.edu/~joh13266/echo.php/" method="post"> + <form action="http://localhost:9001" method="post"> <p class="Form"> <label>Name: <input name="name" pattern="[A-za-z0-9]+" required title="Contact's name must be alphanumeric." type="text" size="25" maxlength="30" id="name"><br><br> diff --git a/csci4131/hw4/strap012/strap012.py b/csci4131/hw4/strap012/strap012.py index 469be81..f498222 100644 --- a/csci4131/hw4/strap012/strap012.py +++ b/csci4131/hw4/strap012/strap012.py @@ -37,14 +37,13 @@ def getContents(type, file): returnValue = b"".join( [returnValue, forb.read(), "{}{}".format(CRLF, CRLF).encode()]) else: - if type == "HEAD" or "GET": - returnValue = OK.encode() - if type == "GET": - returnValue = b"".join( - [returnValue, content.read(), "{}{}".format(CRLF, CRLF).encode()]) - else: - returnValue = b"".join( - [returnValue, "{}{}".format(CRLF, CRLF).encode()]) + returnValue = OK.encode() + if type == "HEAD": + returnValue = b"".join( + [returnValue, "{}{}".format(CRLF, CRLF).encode()]) + elif type == "GET": + returnValue = b"".join( + [returnValue, content.read(), "{}{}".format(CRLF, CRLF).encode()]) elif type == "POST": print("B") else: |