dotcloud/docker — pull request #1064 by monnand (2013-06-28 22:20:53+00:00)
Title: 156 user agent header

Fixed issue #156: **Add client version to the Headers**

- Added an interface in package *registry* named ``VersionChceker``, which can be used to represent some entity who has a version.
- When create a *Registry* with ``NewRegistry()``, the user can optionally provide arbitrary number of *VersionChecker* interfaces. The *Registry* will remember them and put them in the *User-Agent* header when it makes any HTTP request.
- Added a new internal method for *Registry*, named ``setUserAgent()``, which can set the *User-Agent* header for an *http.Request*. It also takes arbitrary number of *VersionChecker* interfaces which can be used to over-write or append new version information besides the base versions (the versions sent on call to ``NewRegistry()``).
- The version information contained in the *User-Agent* header is json encoded. I'm not sure if this is what we want, but it seems better to me if it is easy to parse. (But if other format is needed instead, it won't be hard to change.)
- Right now, the client will send the following version information:
* Docker's version
* Git commit (if present)
* Go version
* Host's kernel version

Here is an example of a *User-Agent* header: ``{"docker":"0.4.2","go":"go1.1","kernel":"3.8.0-25-generic"}``