Chapter 4. Supporting MIME types
MIME types:
We will start with a very brief discussion about what MIME types are and in partic-
ular what MIME content types are. We will also see how they are associated with file
suffixes in a particular system configuration file.
Modules:
We will then introduce the concept of the module and, in particular, the module that
allows the web server to interpret MIME types.
Let’s take another look at the headers that get sent back by a fully configured web
server.
HTTP/1.1 200 OK
Date: Wed, 19 Mar 2003 09:41:23 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Last-Modified: Wed, 19 Mar 2003 09:40:21 GMT
ETag: "e011-13e-12910b40"
Accept-Ranges: bytes
Content-Length: 318
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Figure 4-1. Outgoing HTTP response headers from a working server
In particular note the Content-Type: header. This identifies the document served as
being of MIME content type text/html. This informs the browser that the document
should be parsed as HTML rather than as plain text. It also tells the browser that the
underlying character set used for the web page is ISO-8859-1.
Now let’s look at the headers coming from our server as it currently stands.
HTTP/1.1 200 OK
Date: Wed, 19 Mar 2003 10:02:11 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Last-Modified: Tue, 18 Mar 2003 14:22:06 GMT
ETag: "2813-138-e4577f80"
Accept-Ranges: bytes
Content-Length: 312
Connection: close
Content-Type: text/plain
Figure 4-2. Outgoing HTTP response headers from our server
The principal difference is that the Content-Type: header now reads text/plain.
MIME types on a Red Hat Linux system
So, how does the system associate MIME content types with files? There are two
ways.
23
Comentarios a estos manuales