226 IM Used
226 IM Used
is used by a specific extension of the HTTP protocol. The
extension allows a HTTP server to send diffs (changes) of resources to clients.
For example, a client (like a browser) might have a cache for a certain
resource. It also has an ETag
stored. When a client wants to see if there’s
an update, it will include the ETag
(in an If-None-Match
header).
If the resource changed server-side, normally the server will just send the entire new resource back. However, it might be true that a smaller part of the resource changed, and sending the whole new version back might be a bit of a waste.
The “Delta Encoding In HTTP” allows a server to only send back the changes, in
the form of some patch or diff format. If the client requested this, and the
server supported it, it will use the 226 IM Used
status to incidate this. If
the server sent back 200 OK
, it knows that the server didn’t support the
standard.
Example
This is a client that already has a cached version of a resource and asks for the latest version:
GET /foo.html HTTP/1.1
Host: bar.example.net
If-None-Match: "123xyz"
A-IM: vcdiff, diffe, gzip
The client tells the server that it supports the vcdiff
and diffe
format
for patches, and also supports gzip
compression.
A supporting server might answer this with this response:
HTTP/1.1 226 IM Used
ETag: "489uhw"
IM: vcdiff
Date: Tue, 25 Nov 1997 18:30:05 GMT
Cache-Control: no-store, im, max-age=30
...
IM
stands for Instance Manipulation
.
Usage
Delta Encoding in HTTP seems like a useful, generic extension of the protocol.
In some ways it’s the reverse of the PATCH
method, which is also fairly
popular.
It also behaves similar to HTTP Range Requests. When a client requests a
range, a server will respond with 206 Partial Content
.
However, I’ve never seen this feature used in the wild, and it’s not entirely clear to me why. A google search for this status only really results in articles discussing HTTP statuses, but no implementations.
Developers who need a feature like this will likely typically use other
mechanisms instead. For example, I can imagine API’s implementing a ?since=
query parameter to do a similar thing instead.
Notes
I don’t know why IM Used
got 226
as its code. It seems weird that 20
numbers were skipped.
References
- RFC3229 - Delta Encoding in HTTP.