CMPT 470, Fall 2012

Exercise 3

For this exercise, you will explore the technology in the course and the basics of HTTP conversations.

Create a file exercise3.txt containing your answers to these questions.

  1. We will start to explore HTTP connections with the most basic tool available: a Telnet connection to port 80. You should be able to do that with any Telnet client; on Linux/Unix, the connection can be made like this:

    telnet server 80

    First request the URL http://cmpt470.csil.sfu.ca/~ggbaker/3/ by Telnetting to cmpt470.csil.sfu.ca on port 80 and making a request like this (with a trailing blank line to indicate the end of the request headers):

    GET /~ggbaker/3/ HTTP/1.1
    Host: cmpt470.csil.sfu.ca
    Connection: close

    In your exercise3.txt file, indicate what the status code was for the server's response.

  2. Repeat the request sending an If-modified-since header to simulate an existing cached version of the page:

    GET /~ggbaker/3/ HTTP/1.1
    Host: cmpt470.csil.sfu.ca
    Connection: close
    If-modified-since: Wed, 19 Sep 2012 01:53:52 GMT

    In your exercise3.txt file, indicate what the status code was for the server's response and how the response differed from the previous question.

  3. To see a redirect in action, request the URL http://cmpt470.csil.sfu.ca/~ggbaker/3 (without the trailing slash) as above.

    In your exercise3.txt file, indicate what the status code was for the server's response and how the response differed from the original request.

  4. [optional] Use Firebug or the Chrome Web Inspector to view the request the same URL. (In the “Net” tab, expand to see the request and response headers.)

    Also have a look at Firebug's display of the HTML source and associated CSS rules. (In the “HTML” tab, expand some elements to explore the markup.)

  5. [optional] The Linux command line tools GET or curl to request these URLs:

    GET http://cmpt470.csil.sfu.ca/~ggbaker/3/
    GET -esS http://cmpt470.csil.sfu.ca/~ggbaker/3
    curl http://cmpt470.csil.sfu.ca/~ggbaker/3/
    curl -I http://cmpt470.csil.sfu.ca/~ggbaker/3/
    curl -I http://cmpt470.csil.sfu.ca/~ggbaker/3

    Have a look at the output (especially of the second command) to see the information displayed.

  6. Each group has a Subversion repository set up, and some instructions are provided. (If a group agrees amongst themselves, they can use GitHub.com instead but we will assume SubVersion in documentation.) We will start using it for this exercise.

    Start by checking out your group's repository with your favourite Subversion client. Create a directory named with your userid in the repository for your work. On the Unix/Linux command line, that looks like:

    svn co https://punch.cs.sfu.ca/svn/CMPT470-1121-g-group-name 470repo
    cd 470repo
    svn mkdir userid
    cd userid

    See the groups page in CourSys for your exact repository URL.

    Create a file helloworld.txt in that directory (containing a line or two of text) and commit it to the repository. Again, in Unix/Linux, that's:

    svn add helloworld.txt
    svn ci

    For the rest of the course, work will be submitted by either committing code to the repository, or uploading and submitting a URL. Of course, your group should use the repository to coordinate sharing group work.

    Determine the Subversion URL of the file you just created (which svn info helloworld.txt will tell you). Add it to the file exercise3.txt as your “answer” to this question.

  7. Use an SCP/SFTP client to transfer the exercise3.txt file to the public_html directory in your home directory on cmpt470.csil.sfu.ca.

Submit the URL of your exercise3.txt file through the Course Management System.


Copyright © , based on content created by Greg Baker.