208 Already Reported
HTTP response status code 208 Already Reported is returned by the server in cases where a HTTP response has already been given with regard to a specific resource. A server opts for this to avoid repeating information about a resource, sometimes caused by multiple bindings. Constant reiteration is not only less efficient in terms of bandwidth, but if a resource loops back onto itself then it may cause an infinite loop error.
Usage
When the 208 Already Reported status code is received, the client will understand that it can refer to data that was previously supplied. Essentially, it is a shortcut taken to mean that the same resource with the same binding was already reported, so additional details will not be given a subsequent time.
Note
The 208 Already Reported status code is used by WebDAV to handle Binding Extensions. It will only occur in cases where the Depth: infinity request was made.
Example
In the example, the client received a 207 Multi-Status HTTP response status code from the server. This is in response to a PROPFIND
request that was processed, where the resources are not fully independent. The /main/ resource has an element, /dependent, that uses the same resource as /main itself. The result is an infinite loop because the Depth: infinity
specifier was part of the request. The loop is broken because the server recognizes that it has already been enumerated and when it comes across it the second time, does not delve into it and returns the 208 Already Reported status code.
Request
PROPFIND /main/ HTTP/1.1
Host: www.example.re
Depth: infinity
DAV: bind
Content-Type: application/xml; charset="utf-8"
Content-Length: 139
<?xml version="1.0" encoding="utf-8" ?>
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:name/>
<d:link/>
</d:prop>
</d:propfind>
Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"
Content-Length: 568
<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:d="DAV:">
<d:response>
<d:href>http://www.example.re/main/</d:href>
<d:propstat>
<d:prop>
<d:name>Main Resource</d:name>
<d:resource-id>
<href>urn:uuid: 1234 … 0000</href>
</d:resource-id>
<d:status>HTTP/1.1 200 OK</d:status>
</d:prop>
</d:propstat>
</d:response>
<d:multistatus xmlns:d="DAV:">
<d:response>
<d:href>http://www.example.re/main/dependent</d:href>
<d:propstat>
<d:prop>
<d:name>Main Resource</d:name>
<d:resource-id>
<href>urn:uuid: 1234 … 0000</href>
</d:resource-id>
<d:status>HTTP/1.1 208 Already Reported</d:status>
</d:prop>
</d:propstat>
</d:response>
</d:multistatus>
Code references
.NET
HttpStatusCode.AlreadyReported
Rust
http::StatusCode::ALREADY_REPORTED
Rails
:already_reported
Go
http.StatusAlreadyReported
Symfony
Response::HTTP_ALREADY_REPORTED
Python3.5+
http.HTTPStatus.ALREADY_REPORTED
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_ALREADY_REPORTED
Angular
@angular/common/http/HttpStatusCode.AlreadyReported
Takeaway
HTTP response status code 208 Already Reported is sent by a server to indicate that the specified resource has already been mentioned and that it will not be done a second time. This is to conserve bandwidth and to break infinite loops in some circumstances.