4 Protocol Examples

When the HTTP client uses the PeerDist Content Encoding, it specifies PeerDist in the Accept-Encoding header field, as shown in the following example.

 GET /index.html HTTP/1.1
 Host: www.hostname.com
 Accept: */*
 Accept-Language: en-US
 Accept-Encoding: gzip, deflate, peerdist
 X-P2P-PeerDist: Version=1.1 
 X-P2P-PeerDistEx: MinContentInformation=1.0, MaxContentInformation=1.0 
 User-Agent: Mozilla/4.0

In this example, the HTTP client announces that it is ready to accept the response entity-body that is encoded using the PeerDist content encoding. It also declares the version of the PeerDist content encoding for which it is configured, as well as the minimum and maximum Content Information Data Structure versions it supports.

If the server sends the HTTP response entity-body encoded with PeerDist content coding, then it will set the Content-Encoding header field value to peerdist as shown in the following example.

 HTTP/1.1 200 OK
 Content-Type: text/html
 Content-Encoding: peerdist
 Content-Length: 198
 Last-Modified: Fri, 01 Aug 2008 01:02:03 GMT
 Accept-Ranges: bytes
 ETag: "8d2babfc81f3c81"
 Server: Microsoft-IIS/7.0
 X-P2P-PeerDist: Version=1.1, ContentLength=184946
 Date: Fri, 01 Aug 2008 10:20:30 GMT
 ...198 bytes of PeerDist Content Information...

In this response, the server indicates that the content is encoded using the PeerDist content encoding. The server used version 1.0 of the PeerDist content encoding. The server could not generate version 2.0 of the PeerDist content encoding because the client specified a MaxContentInformation parameter equal to 1.0. Had the client specified a MaxContentInformation parameter equal to 2.0, then the server could have chosen to respond with version 2.0 of the PeerDist content encoding. The server also includes the content length of the entity-body when it is encoded using the identity content coding. In other words, the Content-Length header field would have had the value 184946 if the Content-Encoding header was either missing or specified "identity" as defined in [RFC2616].

If the server does not have the Content Information Data Structure at the time of the request, the server responds with the original content and includes the X-P2P-PeerDistEx header with MakeHashRequest set to true as shown in the following example.

 HTTP/1.1 200 OK 
 Content-Length: 184946
 Content-Type: image/png
 Last-Modified: Thu, 31 Mar 2011 20:17:35 GMT
 Accept-Ranges: bytes
 ETag: "c184b9ace0efcb1:0"
 Server: Microsoft-IIS/8.0
 X-P2P-PeerDist: Version=1.1
 X-P2P-PeerDistEx: MakeHashRequest=true

In response to the previous message, the client sends a hash request with the X-P2P-PeerDistEx header and HashRequest set to true as shown in the following example.

 GET /welcome.png HTTP/1.1
 Host: www.example.com
 X-P2P-PeerDist: Version=1.1
 X-P2P-PeerDistEx: MinContentInformation=1.0, MaxContentInformation=2.0, HashRequest=true