Page 209 - Open Soource Technologies 304.indd
P. 209

Unit 9: Web Techniques



            The most common status message people get to see is 404 Not Found, which simply means   Notes
            that document you requested does not exists. This is either because it really does not exists
            or because you entered the URL wrong. When a 404 is returned it is usually displayed on the
            browser screen in whatever default format is used by that browser. The server may also transmit
            a detailed error report page along with an error message if the resource call was unsuccessful.

            9.1.2 The HTTP Header
            People who know just enough HTML to be dangerous encounter the term HTTP header and
            may think that is corresponds in some way to the document header in an HTML document. This
            is not the case. The HTML document header is something you have coded into the document
            between <head> tags, and, as far as the server is concerned, is part of the document content
            being sent. The HTML header is information the author has provided for the client application
            about the document. The HTTP header, on the other hand, is information the client and server
            provide each other about the transmission process for the document.
            If you need a concrete example, think of the HTML header as the date and address written at
            the top of a business letter, while the HTTP header is the address written on the outside of the
            envelope. They may both be addresses, but they are physically different things in physically
            different locations.
            The HTTP header contains details about the transaction between the client and server, with
            slight variations depending on whether it is a request or a response. The header information
            can be grouped into three different categories. These are:

            General
            General information fields contain information about either the client or the server. General
            information can be as general as nothing but the current date and time.

            Entity
            Entity information fields contain information about the data being transmitted. Common entity
            information is the date on which the document or resource was lastly modified or the address
            of the document requesting this one.

            Request/Response
            The  request/response  fields  contain  information  about  the  client  and  server  configuration,
            including what sort of documents the client can accept and what sort of requests the server
            can accept. This information includes the server name and version for the server, and the client
            application name and version for the client. It also includes the platform being used by the
            client or the server. This information is often used by client or server applications to customize
            the request or response for the needs of the application on the other end of the connection. It
            can also be used to specify what sort of documents the client can receive, so, for example, the
            server knows not to try to send images or audio files to a text-only interface.
            Each header field is delimited by a line break at the end. In other words, each data field is
            written on its own line. The end of the header section is delimited by one or more blank lines.
            In computer terms, a blank line is nothing but some form of newline character. So the end of
            the header section is actually delimited by a sequence of line break characters with nothing
            between them.
            A sample request header might look as follows:
            GET /utils/servervars.php HTTP/1.1
            Accept: text/html, image/png, image/jpeg, image/gif, */*




                                             LOVELY PROFESSIONAL UNIVERSITY                                   203
   204   205   206   207   208   209   210   211   212   213   214