This repository was archived by the owner on Sep 12, 2018. It is now read-only.
Commit f245656
committed
Drop the old tarsum computation for Docker <0.10
This landed in 82021b4 (Merging bypass-tarsum, 2014-04-07, #300), but
those Dockers are now ancient history.
I'm against this sort of user-agent-dependent behavior in general. If
we want to version the API, it makes sense to have version checks in
one place (e.g. in the URL, or in an explicit Docker-Version header,
or in the PUT payload, ...). I'm happy with either the URL approach
(always explicit) or the Docker-Version approach (defaulting to the
current version). If we make some small change to the API (such as not
storing layer tarsums), and want to add per-feature headers or
registry-side options to enable/disable this behaviour, that's
fine. If we can auto-detect new features (e.g. if
Docker-Checksum-Payload exists, it must be using the new SHA-256
semantics), that's fine too. But regardless of how we version the API,
conflating the API version with the user-agent version just seems
confusing.
Olivier wants us to warn older clients instead of just failing when
their tarsum doesn't match our checksum [1], so we still need to use
their user-agent string to decide which clients get warned. I've
softened the old DockerVersion into a more relaxed
docker_client_version, which no longer rejects non-Docker clients [2].
If we can't version the API, we can at least use a blacklist to deny
old implementations instead of a whitelist that requires other clients
to fake the Docker-daemon User-Agent string.
For the 'PUT /v1/images/<image_id>/checksum' endpoint, we don't need
to rely on the user-agent, because the old X-Docker-Checksum was
replaced by the new X-Docker-Checksum-Payload. If the client isn't
setting X-Docker-Checksum-Payload, just say that in the error message
and hint that it might be due to an outdated client.
I'd like to remove all the user-agent-dependent behavior, but we're
currently also using it to setup some tag metadata in
docker_registry.tags.put_tag. I don't touch that here, since I
haven't tracked down the reasoning behind that behavior (although I
suspect it's also a bad idea ;).
I also haven't touched the user-agent bits under tests/, since I
haven't checked to see if they're designed to test this check, or to
test the put_tags check, or just to bypass either of those checks.
[1]: #570 (comment)
[2]: #3751 parent 99f7d0c commit f245656
2 files changed
+28
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
| |||
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | 223 | | |
247 | 224 | | |
248 | 225 | | |
| |||
251 | 228 | | |
252 | 229 | | |
253 | 230 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
258 | 237 | | |
259 | 238 | | |
260 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
0 commit comments