Web Design Small Cover

Buy the PDF of
Web Design:
A Complete Introduction

See the book at amazon.co.uk or amazon.com

Related Site

Web Security Topics

Related Books

Secure Communication Cover

Securing A Server Cover

Answers to Exercises, Chapter 2

Test Questions

  1. No. It's a redundant convention, left over from days when institutions like universities would reserve one of the machines on their local area network to serve Web pages. The www name was largely for identifying it internally. However, the convention persists. (Some domain registrars impose it when a domain name is registered.)
  2. The purpose of the DNS is to translate domain names, which are easy for people to read and remember, into numerical IP addresses, which are used by the underlying network to direct data to the right destination. In theory the Web could exist without the DNS – numerical IP addresses can be used in URLs – but it would be much harder for people to use. (If you know a company's name you can often guess the URL, but you couldn't possible guess the IP address.)
  3. The two types of HTTP message are requests and responses. A request consists of a request line, followed by some headers, a blank line and the message body. A response consists of a status line, some headers and, if there is any data in the response, a blank line followed by the message body. For examples, see the text, p52ff.
  4. The interactions between the client and server are summarized at the bottom of Figure 2.7 (for a POST request). The browser collects together the data entered into the form, encodes it as a query string, and sends it in a request: if it is a POST request, the data is sent in the message body, if it is a GET request it is apended to the URL in the request line. The server passes this data to a script or program running on the remote machine, which performs some computation and returns a result in the form of an HTTP response. The server then takes this response and sends it back to the browser which displays it.
  5. The first component has the form name=value; it gives the cookie a name and sets its value. The second component has the form expires=date, and stipulates when the browser should discard the cookie. If this component is omitted, the cookie is discarded at the end of the session. The next two components are a domain and path; the browser will only send the cookie in requests to URLs within that path and domain. The final component specifies whether the cookie should only be sent in secure requests. All of these components except the last might be used in an online store. The value would be an identifier for the customer, allowing the store to retrieve data about them, such as the contents of their shopping basket, whenever they sent a request. The expires header would be required if it was necessary to remember details about customers for longer than a single session. (It normally is.) The domain is always needed; using the path as well can improve efficiency, since the cookie will not be sent to pages that lie outside the directory specified by the path. Cookies for online stores would not normally be secure: only interactions concerned with payment need to be done over secure connections, and cookies are used for more than that.
  6. Table 2.1 gives a list of Internet Media Types that covers most pages. Of these, the most common are text/html (though it is possible this will be superseded in time, as we note in Chapter 3), text/css, text/javascript, image/jpeg and image/gif. (With the increase in Flash Video on the Web, application/x-shockwave-flash will become common, see Chapter 6.)
  7. The main problem with all caching mechanisms is that the information in the cache may become outdated. The If-Modified-Since header allows a browser to ask the server whether its cached copy has been superseded. An ETag value can be sent in the If-None-Match header, to stop the server resending a document identical to the one in the browser's cache. The advantage of caching is simply that it can reduce the amount of data that must be sent from a server to a browser.
  8. A Web proxy stands between clients and the Internet; requests from clients are redirected to the proxy, which forwards them to their true destination. Responses are received by the proxy and passed back to the client. The main purpose of this arrangement is security. Clients can be protected from the network by a firewall, but this would block their access to the Web. A proxy can pass data across the firewall on their behalf. This way only the proxy needs to have elaborate security measures in place. The benefit is thus increased security for machines within the firewall. Since many requests pass through the proxy, it makes sense to provide it with a large local cache, so as an indirect benefit, it may decrease Internet traffic and improve response times.
  9. Text is represented by mapping characters to numbers, because numbers can be represented digitally using the binary system by interpreting bits as 1s and 0s. The mapping between such numbers and characters can be arbitrary, but standards are required to ensure that peripherals interpret character codes correctly, and that text files can be exchanged between different systems and transmitted over networks. Character sets are standard mappings for this purpose.
  10. No. The A stands for Asymmetrical, because the upstream speed is much less than the downstream speed. Since a server mostly sends data upstream, an ADSL connection would not provide sufficient bandwidth in the required direction.
  11. The big advantage of satellites is that they can reach remote areas where it is not technically or economically feasible to provide other forms of broadband access, such as ADSL or cable. Their disadvantages include latency (the time taken for a signal to travel up to the satellite and back down to Earth), sensitivity to weather and misalignment of the receiver, and cost.

Discussion Topics: Hints and Tips

  1. The second part of this question really demands quite a technical answer, but even if you do not know much about such things it will be instructive to imagine what difference adding state to HTTP would make to the behaviour of the server.
  2. Since we must assume that new types of media may come along, you have to consider how easy it is to extend the repertoire of types. As an indication, consider the introduction of a convention for indicating XML data (which suggested this question).
  3. Find out about Internationalized Resource Identifiers.
  4. Another way of looking at this question is to consider what route you would take around the world to maximize your chances of staying online. (We don't necessarily mean continuously online 24 hours a day, but able to look at Web pages wherever you stopped.) Don't just think about connections to domestic premises or mobile phones, but consider public facilities, like Internet cafes and libraries, which might be more readily available in some countries.
  5. Consider all the things that the Web is and could become, and all the services it provides. Also think about the changing role of video and ways it might be used for communication.

Practical Tasks: Hints and Tips

  1. The domain desperatesw.co.uk is redirected by our Web hosting provider to the support page for this book, which is itself a sub-directory within our umbrella domain macavon.org, so you should see how the server handles the redirection and sends you to the intended page.
  2. This can be quite a shocking experience, as many sites seem to dump enormous numbers of cookies on you for no apparent reason. See how many cookies you cannot see any purpose for. If your browser is set up to allow all cookies, how many of them come from sites you have never visited?