Please Whitelist This Site?
I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)
If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.
If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.
Thanks for your understanding!
Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide
|
NOTE: Using software to mass-download the site degrades the server and is prohibited. If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.
|
|
|
|
|
The TCP/IP Guide
9 TCP/IP Application Layer Protocols, Services and Applications (OSI Layers 5, 6 and 7)
9 TCP/IP Key Applications and Application Protocols
9 TCP/IP File and Message Transfer Applications and Protocols (FTP, TFTP, Electronic Mail, USENET, HTTP/WWW, Gopher)
9 TCP/IP World Wide Web (WWW, "The Web") and the Hypertext Transfer Protocol (HTTP)
9 TCP/IP Hypertext Transfer Protocol (HTTP)
9 HTTP Entities, Transfers, Coding Methods and Content Management
|
HTTP Data Length Issues, "Chunked" Transfers and Message Trailers
(Page 3 of 3)
Example Using the Content-Length Header and "Chunking"
Yes, I really did say that headers
can actually be trailers, in which case a header called Trailer
lists each header that is actually a trailer. Perhaps an example would
help clarify matters somewhat? Suppose we have a server that contains
a program that, when supplied with a file name, returns a simple HTML
response that contains the size and last modification date of the file.
This is obviously dynamic content, so the length of the response cannot
be determined in advance.
If the server were to buffer the
entire output of this program (since it is small) it could construct
a conventional HTTP response using the Content-Length header,
as shown in the sample output of Table 278.
Instead, chunking allows the server to send out parts of the response
as soon as they become available from the program. The equivalent output
of that example using chunked transfers is shown in Table 279;
notice that the Expires header is now a trailer, so it can be
calculated based on the output of the program, and this is indicated
by the Trailer: Expires header. Remember that the
Content-Length header specifies the length as a decimal number
while chunking specifies chunk lengths in hexadecimal; the chunks in
this example are 41, 5, 35, 29 and 19 bytes, respectively.
Table 278: Example HTTP Response Using Content-Length Header
HTTP/1.1 200
OK
Date: Mon, 22 Mar 2004 11:15:03 GMT
Content-Type: text/html
Content-Length: 129
Expires: Sat, 27 Mar 2004 21:12:00 GMT
<html><body><p>The file you requested is 3,400 bytes
long and was last modified: Sat, 20 Mar 2004 21:12:00 GMT.</p></body></html>
|
Table 279: Example HTTP Response Using Chunked Transfer Encoding
HTTP/1.1 200
OK
Date: Mon, 22 Mar 2004 11:15:03 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Trailer: Expires
29
<html><body><p>The file you requested is
5
3,400
23
bytes long and was last modified:
1d
Sat, 20 Mar 2004 21:12:00 GMT
13
.</p></body></html>
0
Expires: Sat, 27 Mar 2004 21:12:00 GMT
|
Note: An HTTP/1.1 client can specify that it does not want to use persistent connections by including the Connection: close header in its request. In this case, the server does not have to use chunking in its responsesince it will close the connection after the first response message, the client knows that everything it receives from the server is part of that response. However, some servers may use chunked transfers anyway, even in this situation. |
Key Concept: When chunked transfer encoding is used, the sender of the message may move certain headers from the start of the message to the end, where they are known as trailers. They are interpreted in the same way as normal headers by the recipient. The special Trailer header is used in such messages to tell the recipient to look for trailers after the body of the message. |
If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support! |
|
|
Home -
Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.
|