Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Parse HTTP range headers
Browse files Browse the repository at this point in the history
Need to parse range headers so that entire range can be requested from singularity. Otherwise it is necessary to read the whole file.

An optimization would be to determine if the ranges are contiguous, and then only make one request that spans contiguous ranges. This is not necessary though if clients already combine contiguous ranges into a single larger range.
  • Loading branch information
gammazero committed Oct 31, 2023
1 parent 00ccef1 commit a837654
Show file tree
Hide file tree
Showing 3 changed files with 576 additions and 15 deletions.
2 changes: 1 addition & 1 deletion api/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (m *HttpServer) handleBlobGetByID(w http.ResponseWriter, r *http.Request, i
w.Header().Set(httpHeaderContentTypeOptionsNoSniff())
w.Header().Set(httpHeaderContentLength(blobDesc.Size))
w.Header().Set("Content-Disposition", fmt.Sprintf(`attachement; filename="%s.bin"`, id.String()))
http.ServeContent(w, r, "", blobDesc.ModificationTime, blobReader)
serveContent(w, r, "", blobDesc.ModificationTime, blobReader)
logger.Debug("Blob fetched successfully")
}

Expand Down
Loading

0 comments on commit a837654

Please sign in to comment.