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)
| 576 | // This implementation of the GET operation retrieves object. To use GET, |
| 577 | // you must have READ access to the object. |
| 578 | func (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 | |
| 607 | func (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 |
nothing calls this directly
no test coverage detected