MCPcopy
hub / github.com/minio/minio-go / addSignedTrailer

Method addSignedTrailer

pkg/signer/request-signature-streaming.go:255–282  ·  view source on GitHub ↗

addSignedTrailer - adds a trailer with the provided headers, then signs a chunk and adds it to output.

(h http.Header)

Source from the content-addressed store, hash-verified

253// addSignedTrailer - adds a trailer with the provided headers,
254// then signs a chunk and adds it to output.
255func (s *StreamingReader) addSignedTrailer(h http.Header) {
256 olen := len(s.chunkBuf)
257 s.chunkBuf = s.chunkBuf[:0]
258 for k, v := range h {
259 s.chunkBuf = append(s.chunkBuf, []byte(strings.ToLower(k)+trailerKVSeparator+v[0]+"\n")...)
260 }
261
262 s.sh256.Reset()
263 s.sh256.Write(s.chunkBuf)
264 chunkChecksum := hex.EncodeToString(s.sh256.Sum(nil))
265 serviceType := s.serviceType
266 if serviceType == "" {
267 serviceType = ServiceTypeS3
268 }
269 signature := buildTrailerChunkSignature(chunkChecksum, s.reqTime,
270 s.region, s.prevSignature, s.secretAccessKey, serviceType)
271
272 // For next chunk signature computation
273 s.prevSignature = signature
274
275 s.buf.Write(s.chunkBuf)
276 s.buf.WriteString("\r\n" + trailerSignature + trailerKVSeparator + signature + "\r\n\r\n")
277
278 // Reset chunkBufLen for next chunk read.
279 s.chunkBuf = s.chunkBuf[:olen]
280 s.chunkBufLen = 0
281 s.chunkNum++
282}
283
284// setStreamingAuthHeader - builds and sets authorization header value
285// for streaming signature.

Callers 1

ReadMethod · 0.95

Calls 2

EncodeToStringMethod · 0.80

Tested by

no test coverage detected