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

Function writeCanonicalizedHeaders

pkg/signer/request-signature-v2.go:219–242  ·  view source on GitHub ↗

writeCanonicalizedHeaders - write canonicalized headers.

(buf *bytes.Buffer, req http.Request)

Source from the content-addressed store, hash-verified

217
218// writeCanonicalizedHeaders - write canonicalized headers.
219func writeCanonicalizedHeaders(buf *bytes.Buffer, req http.Request) {
220 var protoHeaders []string
221 vals := make(map[string][]string)
222 for k, vv := range req.Header {
223 // All the AMZ headers should be lowercase
224 lk := strings.ToLower(k)
225 if strings.HasPrefix(lk, "x-amz") {
226 protoHeaders = append(protoHeaders, lk)
227 vals[lk] = vv
228 }
229 }
230 sort.Strings(protoHeaders)
231 for _, k := range protoHeaders {
232 buf.WriteString(k)
233 buf.WriteByte(':')
234 for idx, v := range vals[k] {
235 if idx > 0 {
236 buf.WriteByte(',')
237 }
238 buf.WriteString(v)
239 }
240 buf.WriteByte('\n')
241 }
242}
243
244// AWS S3 Signature V2 calculation rule is give here:
245// http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationStringToSign

Callers 2

preStringToSignV2Function · 0.85
stringToSignV2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected