CNT4713 Extra Credit 1
Due Wednesday 6/1 (late: 6/2 at 6am)
Each of the following scripts is worth one point of extra credit.
- Write a web server that implements a conditional
GET
, using the
If-modified-since
header. The web server only has to be able to
return one file, but it must be an actual file. If the browser already has the
file, only send the appropriate HTTP response to indicate that the browser
already has the file. Request a port
for your web server, so we can minimize the chance of students using the same port.
-
Modify the FTP script so that it downloads a file. First, try
downloading the README.txt from the root folder. Second, list
the contents of a subdirectory that has files. Third, download
a file from a subdirectory.
-
Run the SMTP script and send a message to bytesizebook@gmail.com.
Modify the script so that it includes a header named X-MC-Tags
with the value of your FIU email username.
-
Create a web folder on ocelot named
public_html in your root folder. Change the permissions to 705.
- Change the permissions on your root folder to 701 with
chmod 701 ~
-
Create a subfolder of public_html named cgi-bin.
Change the permission to 705.
-
Write a CGI script on ocelot. Save it in the cgi-bin folder. Change its permission to 705.
Be sure the file has a .cgi extension, not .py.
Parse all the data that is sent to the form from a browser. Display each name value pair in a
sentence like "The input element with name team has the value Heat". Display the request method
that was used to submit the data.
- Create a file named form.html that has two forms in it. One form uses GET, the other uses POST.
The GET form should have three text elements, the POST form should have four.
Both forms have an action set to your script. Place the file in public_html. Set its permissions to
604. Add a submit button in each form to submit it.
-
Open the form.html file in a browser, using the URL ocelot.aul.fiu.edu/~your-user-name/form.html.
Click each button and see that the appropriate response appears for each.
Deploying the Assignment
Change All Scripts to CGI Scripts
The following changes to your scripts will allow them to be run from ocelot. Replace
username
with your FIU email usernam and script-name
with
the name of the script in the following URL:
http://ocelot.aul.fiu.edu/~username/cgi-bin/script-name.cgi
Limiting Access to cgi-bin
We do not want other people (like hackers) to run your scripts (over and over again).
Creating an Index Page in public_html
I want to be able to run your scripts on ocelot, without having to type the
name of each script in the URL.
- Create a file named
index.html
in the public_html
folder.
- Use my index page as a reference:
Index Page.
- you may copy the source of my page and modify it with your name and the names of your scripts.
Submitting the Assignment
To hand in
the assignment, place all your scripts in the cgi-bin folder on ocelot.
Zip the public_html folder, including the cgi-bin folder.
DO NOT USE 7-ZIP or RAR!!!
- Please use the following command to your public_html
folder.
zip -r ~/username ~/public_html -x \*.zip
Replacing username with your user name. This will create a file
named username.zip.
- Check the size of the ZIP file, it should be less than 3 MB. If it is
not, then you probably have another ZIP file stored in the ZIP archive.
Delete it and re-zip.
- You then have a choice for submitting the file.
- If you are logged onto ocelot, use my uploading program to upload the
file. Enter this command at the command prompt:
~downeyt/cs/public/webftp/webftp.pl
- If you are using winscp, then download the zip file to your computer;
then, upload the file to me:
Submitting
homework on-line via the Web.
- Upload the file as binary.