HTML and CSS Reference
In-Depth Information
Chapter 4
Serving and Configuration
The correct appearance and web documents handling cannot be guaranteed simply by applying strict, error-free
markup. Web server configuration has a significant impact on web site appearance, operation, and behavior. Documents
should be served with the proper media type and character encoding. Content negotiation can be used to serve various
document versions to browsers supporting the corresponding media types. XHTML documents can be served as either
HTML or XML, but there is a huge difference in processing. XML files are processed by XML parsers that are far more
error-sensitive than SGML parsers. XHTML served as XML involves the risk that the document cannot be rendered at
all. On the other hand, backward-compatible serving cannot use the benefits of strict XML markup. There are several
aspects of sending HTML and XHTML from the server to the rendering engine, all of which should be considered to
achieve proper settings.
In this chapter, you will learn how to configure your web site, browser, and server in order to serve web documents
correctly. Becoming familiar with the most important MIME types is crucial for properly serving web documents and
the files used by them, for example, style sheets, images, audio and video files, ZIP archives, and office documents.
Beyond Internet media types, you will also learn domain configuration; the difference between URIs, URLs, and
URNs; the application of base directories; and practices to eliminate file extensions.
The HTTP Header
The foundation of data communication on the World Wide Web is the Hypertext Transfer Protocol (HTTP). It is a
networking protocol that functions as a request-response protocol in a client-server computing model. In this model,
a typical client is a web browser, while an application that runs on the host of a web site is a server. During each query,
the client submits an HTTP request message to the server. In return, the server sends a response message to the client
that contains additional data, such as completion status information about the request, which is sent along with web
documents from the server to the user agent. These header fields form the HTTP header . The header fields determine
the parameters of the HTTP communication. HTTP requests are used to indicate which content types and character
sets are acceptable ( Accept , Accept-Charset ), the date and time the message was sent ( Date ), the domain name
( Host ), a string representing a user agent ( User-Agent ), and so on.
As you can see in Listing 4-1, HTTP responses provide the name of the server ( Server ), an alternate location
for the returned data ( Content-Location ), and the date and time after which the response expires ( Expires ). The
Vary field confirms whether the cached response can be used rather than repeat the request. The Platform for
Privacy Preferences Project (P3P) policy can be set by the P3P field. An identifier of a specific version of the resource
is provided by ETag . These are the most common HTTP header fields, but there are many more, all of which are
described by RFC 4229 [1].
Search WWH ::

Custom Search