This project will get you started with creating a simple webpage server.
Directory structure:
-
the "pages" (HTML files and their assets) will be located in DOCROOT. For this project that location is the
pages/
directory. Make sure you specify this in yourcredentials.ini
!- Make sure you don't hardcode either
pages/
or the port number -- they should be read fromcredentials.ini
, ordefault.ini
ifcredentials.ini
does not exist.
- Make sure you don't hardcode either
-
Everything that's located in
pageserver/
. That consists of a Python application (pageserver.py
) that starts listening at a specified port and handles requests. This is the key file you'll be editing for this project. -
There's a configuration parser, much like the one seen in project-0, but a more detailed version. It not only looks for your
credentials.ini
file, both inpageserver/
and the parent directory and falls back todefault.ini
if missing, it also allows you to override those settings through CLI. These will be discussed in the lab. -
Makefile
here refers to the two scripts provided:start.sh
andstop.sh
. The former starts the server, by callingpageserver.py
. It will also store its PID (process id), in order to kill it later throughstop.sh
. However, if you notice that it failed to do so, you can kill it manually by looking up the PID.
The goal of this project is to implement a "file checking" logic for the existing server. Currently, if you set it up and start the server, it will just serve a page with a cat figure. What is expected is for the server to handle the requests as follows:
-
If a file exists in
DOCROOT
(pages/
in this case) (i.e.trivia.html
, any name, any extention or format) exists, transmit200 OK
header followed by that file. If the file doesn't exist, transmit404 Not Found
error code in the header along with a message in the body explaining further. If a request includes illegal characters (..
or~
), the response should be a403 Forbidden
error, again with a message in the body explaining it. -
Update
README
with your name, info, and a brief description of the project. -
You will submit your credentials.ini in Canvas. It should include your name and repo URL.
- If everything works as expected, 100 will be assigned.
- If existing pages and files are NOT handled correctly, 30 points will be docked.
- For each of the errors not handled correctly (403, and 404), 15 points will be docked.
- If
README.md
is not updated with your name and info, 10 points will be docked. - If
credentials.ini
is commited, 10 points will be docked. - If the repo clones, but
make install
ormake run
throws an error, 10 will be assigned. - If
credentials.ini
is incorrect or not submitted, 0 will be assigned.
Carsten Konyn.
I did the project, I was confused about how to access the file but I did it. I also didn't know that I could import inbuilt libraries which made me try using a try and except instead of a much simpler method.