Commit 3b35fc3
committed
http: avoid possible digest mismatch error
There is a possibility to get a digest mismatch error
if the metadata for previous download does not point to
a valid reference anymore.
To mitigate this, check that ref that etag points to
is still valid before using it.
Additionally `.cacheKey` property was not previously
set in the cases where old reference was reused. This
caused a case where even if the download needed to be
performed again, it always failed validation, even if
the digest had not actually changed since previous download.
There is still a small possibility that gc/prune request
will delete the downloaded record in between cachemap and
exec call and that the contents changes in the server
at that exact time. To fix that case we would need to
modify cachemap so that it can keep hold of references
until build is complete.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>1 parent 293ef59 commit 3b35fc3
1 file changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
| |||
235 | 241 | | |
236 | 242 | | |
237 | 243 | | |
| 244 | + | |
238 | 245 | | |
239 | 246 | | |
240 | 247 | | |
| |||
275 | 282 | | |
276 | 283 | | |
277 | 284 | | |
| 285 | + | |
278 | 286 | | |
279 | 287 | | |
| 288 | + | |
280 | 289 | | |
281 | 290 | | |
282 | 291 | | |
| |||
421 | 430 | | |
422 | 431 | | |
423 | 432 | | |
424 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
425 | 436 | | |
426 | 437 | | |
427 | 438 | | |
| |||
0 commit comments