13.06.2015 Views

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.4.3 mod gzip<br />

More will be said about mod gzip later. Files are compressed as <strong>the</strong>y are sent out <strong>to</strong> <strong>the</strong> client, and an<br />

additional Content-Encoding header is attached <strong>to</strong> <strong>the</strong> file <strong>to</strong> let <strong>the</strong> browser know that <strong>the</strong> content needs<br />

<strong>to</strong> be decoded (uncompressed) before it can be displayed.<br />

7.5 Language<br />

• Content-Language header specifies <strong>the</strong> language that is being sent<br />

• Browser configuration can determine <strong>the</strong> preferred language (See Content Negotiation)<br />

• Can be set in addition <strong>to</strong> o<strong>the</strong>r attributes<br />

7.6 Multiple file extensions<br />

Files can have more than one file extension in order <strong>to</strong> convey more than one of <strong>the</strong> above pieces of information.<br />

file.tar.gz.en<br />

file.tar.Z.fr<br />

file.html.gz.de<br />

There’s no great value of going in<strong>to</strong> much detail here with <strong>the</strong> language stuff, as we will get in<strong>to</strong> much greater<br />

depth in <strong>the</strong> Content Negotiation section, which is just a few down <strong>the</strong> line.<br />

You may also wish <strong>to</strong> make a note that multiple file extensions conveying <strong>the</strong> same piece of information will<br />

cause all but <strong>the</strong> last one <strong>to</strong> be ignored. Thus file.doc.tar.txt is a text file, not a doc or tar file.<br />

7.7 Experiment<br />

• In your vhost direc<strong>to</strong>ry, create a file called something.abc<br />

• Add a MIME type <strong>to</strong> this file extension<br />

• Verify that your browser loads it with this MIME type, and asks you what it is supposed <strong>to</strong> do with<br />

it.<br />

The purpose of this exercise is <strong>to</strong> illustrate that you can make up your own file types, and cause <strong>the</strong> browser<br />

<strong>to</strong> behave a certain way upon receiving that file type. This is how people come up with cus<strong>to</strong>m plug ins, file<br />

handlers, or whatever. You have some client-side application that gets mapped <strong>to</strong> a particular MIME type<br />

header.<br />

Note also that Internet Explorer occasionally thinks that it is smarter than you. That is, it will, in some conditions,<br />

follow <strong>the</strong> file extension ra<strong>the</strong>r than <strong>the</strong> MIME type. Thus, a txt file with an Application/Unknown<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!