|
1 | | -============= |
| 1 | +############# |
2 | 2 | HTTP Messages |
3 | | -============= |
| 3 | +############# |
4 | 4 |
|
5 | 5 | The Message class provides an interface to the portions of an HTTP message that are common to both |
6 | 6 | requests and responses, including the message body, protocol version, utilities for working with |
7 | 7 | the headers, and methods for handling content negotiation. |
8 | 8 |
|
9 | | -This class is the parent class that both the :doc:`Request Class </incoming/request>` and the |
10 | | -:doc:`Response Class </outgoing/response>` extend from. As such, some methods, such as the content |
11 | | -negotiation methods, may apply only to a request or response, and not the other one, but they have |
12 | | -been included here to keep the header methods together. |
13 | | - |
14 | | -What is Content Negotiation? |
15 | | -============================ |
16 | | - |
17 | | -At it's heart Content Negotiation is simply a part of the HTTP specification that allows a single |
18 | | -resource to serve more than one type of content, allowing the clients to request the type of |
19 | | -data that works best for them. |
20 | | - |
21 | | -A classic example of this is a browser that cannot display PNG files can request only GIF or |
22 | | -JPEG images. When the server receives the request, it looks at the available file types the client |
23 | | -is requesting and selects the best match from the image formats that it supports, in this case |
24 | | -likely choosing a JPEG image to return. |
25 | | - |
26 | | -This same negotiation can happen with four types of data: |
27 | | - |
28 | | -* **Media/Document Type** - this could be image format, or HTML vs. XML or JSON. |
29 | | -* **Character Set** - The character set the returned document should be set in. Typically is UTF-8. |
30 | | -* **Document Encoding** - Typically the type of compression used on the results. |
31 | | -* **Document Language** - For sites that support multiple languages, this helps determine which to return. |
| 9 | +This class is the parent class that both the :doc:`Request Class <../incoming/request>` and the |
| 10 | +:doc:`Response Class <../outgoing/response>` extend from. |
32 | 11 |
|
33 | 12 | *************** |
34 | 13 | Class Reference |
@@ -68,7 +47,7 @@ Class Reference |
68 | 47 | :returns: void |
69 | 48 |
|
70 | 49 | Scans and parses the headers found in the SERVER data and stores it for later access. |
71 | | - This is used by the :doc:`IncomingRequest Class </incoming/incomingrequest>` to make |
| 50 | + This is used by the :doc:`IncomingRequest Class <../incoming/incomingrequest>` to make |
72 | 51 | the current request's headers available. |
73 | 52 |
|
74 | 53 | The headers are any SERVER data that starts with ``HTTP_``, like ``HTTP_HOST``. Each message |
|
0 commit comments