Week 12 Exercises

  1. Modify the Webcat program so that it's not necessary to type the full URL. If only a hostname is typed, e.g. students.poly.edu, assume that you should connect to an http server on the default port at that address, e.g. http://students.poly.edu/. It should also be possible to specify a file part. That is http://www.cafeaulait.org/ and metalab.unc.edu/javafaq/ should bothe be acceptable input.

    However, if the hostname begins with ftp, e.g. ftp.javasoft.com, assume you should connect to an ftp server at that address, e.g. ftp://ftp.javasoft.com/. Similarly, if the hostname begins with gopher, assume you should connect to a gopher server at that address.

    If a full host name is not provided, but only a single word, first check whether it is a server in the local domain. For example, entering duke on utopia.poly.edu should attempt to connect to duke.poly.edu. However if the word is not a hostname in the local domain, then assume it points to an http server at www.word.com. For example, if yahoo is entered on the command line, you should try to connect to http://www.yahoo.com/.

    Provide reasonable error messages in the event that the host cannot be located or the connection attempt fails.

    Note that this is more or less how Netscape Navigator behaves.


Start | Previous | Cafe au Lait

Copyright 1997, 1999, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified April 6, 2006