MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / GetObjectHandler

Method GetObjectHandler

cmd/object-handlers.go:578–605  ·  view source on GitHub ↗

GetObjectHandler - GET Object ---------- This implementation of the GET operation retrieves object. To use GET, you must have READ access to the object.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

576// This implementation of the GET operation retrieves object. To use GET,
577// you must have READ access to the object.
578func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Request) {
579 ctx := newContext(r, w, "GetObject")
580
581 defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r))
582
583 objectAPI := api.ObjectAPI()
584 if objectAPI == nil {
585 writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL)
586 return
587 }
588
589 vars := mux.Vars(r)
590 bucket := vars["bucket"]
591 object, err := unescapePath(vars["object"])
592 if err != nil {
593 writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
594 return
595 }
596 if !globalAPIConfig.shouldGzipObjects() {
597 w.Header().Set(gzhttp.HeaderNoCompression, "true")
598 }
599
600 if r.Header.Get(xMinIOExtract) == "true" && strings.Contains(object, archivePattern) {
601 api.getObjectInArchiveFileHandler(ctx, objectAPI, bucket, object, w, r)
602 } else {
603 api.getObjectHandler(ctx, objectAPI, bucket, object, w, r)
604 }
605}
606
607func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI ObjectLayer, bucket, object string, w http.ResponseWriter, r *http.Request) {
608 if crypto.S3.IsRequested(r.Header) || crypto.S3KMS.IsRequested(r.Header) { // If SSE-S3 or SSE-KMS present -> AWS fails with undefined error

Callers

nothing calls this directly

Calls 14

getObjectHandlerMethod · 0.95
AuditLogFunction · 0.92
newContextFunction · 0.85
mustGetClaimsFromTokenFunction · 0.85
unescapePathFunction · 0.85
toAPIErrorFunction · 0.85
ToAPIErrMethod · 0.80
shouldGzipObjectsMethod · 0.80
ContainsMethod · 0.80
writeErrorResponseFunction · 0.70
SetMethod · 0.65

Tested by

no test coverage detected