Matthew L. Wright
Visiting Assistant Professor, St. Olaf College

Homework 14: HTTP and HTML

CS 121 ⋅ Spring 2016

The following exercises involve Python sockets, HTTP, and HTML. Post the files (one Python file and one HTML file) containing your solutions to Moodle for HW14.

  1. Modify the Python "socket" program from class so that it:
    1. Prints the received HTTP status code to the console.
    2. Saves the data it receives to a file. Only the data from the requested file should be saved; the HTTP header should not be saved.
    Your program should work with any length of data file. In particular, you can test your program by retreiving the following (long) file: http://www.mlwright.org/teaching/cs121/milton.txt.
  2. Create a HTML file for a basic web page. Specifically, your web page should contain:
    • Your name, as a heading (use <h1> tags).
    • A paragraph of text about something that interests you (use <p> tags).
    • An unordered list (use <ul> and <li> tags).
    • Some text marked as important or emphasized (use <strong> or <em> tags).
    • A link to another web page (use <a> tags).
    Make sure that every start tag is paired with a closing tag, and that your code is valid (i.e., tags are properly nested). Test your page by viewing it in a browser.
    Tips: