MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / parseRangeHeader

Function parseRangeHeader

storage/abs/reader.go:105–131  ·  view source on GitHub ↗
(opts *blob.DownloadStreamOptions, reqHeader http.Header)

Source from the content-addressed store, hash-verified

103}
104
105func parseRangeHeader(opts *blob.DownloadStreamOptions, reqHeader http.Header) (bool, error) {
106 r := reqHeader.Get(httpheaders.Range)
107 if len(r) == 0 {
108 return false, nil
109 }
110
111 start, end, err := httprange.Parse(r)
112 if err != nil {
113 return false, err
114 }
115
116 if end == 0 {
117 return false, nil
118 }
119
120 length := end - start + 1
121 if end <= 0 {
122 length = blockblob.CountToEnd
123 }
124
125 opts.Range = blob.HTTPRange{
126 Offset: start,
127 Count: length,
128 }
129
130 return true, nil
131}

Callers 1

GetObjectMethod · 0.85

Calls 2

ParseFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected