Commit 1a1f84d
authored
Multipart download enhancements (#4021)
* fix(api): set blob response Content-Type from OCI descriptor
Blob HEAD responses had no Content-Type and GET responses echoed the
request's Accept header verbatim, which produced missing or malformed
media types and left multipart/byteranges parts without a per-part
Content-Type. This breaks OCI distribution-spec conformance and
consumers like stargz-snapshotter that need a well-formed layer media
type.
Add a blobResponseMediaType helper that resolves the descriptor's
MediaType via GetBlobDescriptorFromRepo and falls back to
application/octet-stream. Use it in CheckBlob (HEAD), GetBlob full
(200), GetBlob single-range (206), and per-part in
writeMultipartRanges (206 multipart). Lookup is deferred until after
the blob is known to exist.
Cover the new behaviour with mock-based unit tests in routes_test.go
and end-to-end assertions in TestPullRange.
Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
* perf(api): stream multipart blob ranges lazily with precomputed Content-Length
writeMultipartRanges previously opened every range reader up front
and emitted no Content-Length, so an N-range request held N
concurrent storage readers (and their fds / read buffers) per
response window and forced chunked encoding on HTTP/1.1 — neither
friendly to proxies nor to fan-out scenarios like stargz lazy pulls.
Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
---------
Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>1 parent bb5b77a commit 1a1f84d
3 files changed
Lines changed: 1318 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11247 | 11247 | | |
11248 | 11248 | | |
11249 | 11249 | | |
| 11250 | + | |
| 11251 | + | |
| 11252 | + | |
| 11253 | + | |
11250 | 11254 | | |
11251 | 11255 | | |
11252 | 11256 | | |
| |||
11255 | 11259 | | |
11256 | 11260 | | |
11257 | 11261 | | |
| 11262 | + | |
| 11263 | + | |
| 11264 | + | |
| 11265 | + | |
| 11266 | + | |
11258 | 11267 | | |
11259 | 11268 | | |
11260 | 11269 | | |
| |||
11318 | 11327 | | |
11319 | 11328 | | |
11320 | 11329 | | |
| 11330 | + | |
| 11331 | + | |
| 11332 | + | |
| 11333 | + | |
| 11334 | + | |
11321 | 11335 | | |
11322 | 11336 | | |
11323 | 11337 | | |
| |||
11326 | 11340 | | |
11327 | 11341 | | |
11328 | 11342 | | |
| 11343 | + | |
11329 | 11344 | | |
11330 | 11345 | | |
11331 | 11346 | | |
| |||
0 commit comments