httpobj* handlers // GET /v1/objects/ / Initially validates if the request is internal request (either from proxy or target) and calls getObject. Checks if the object exists locally (if not, downloads it) and sends it back If the bucket is in the Cloud one and ValidateWa
(w http.ResponseWriter, r *http.Request)
| 934 | // If the bucket is in the Cloud one and ValidateWarmGet is enabled there is an extra |
| 935 | // check whether the object exists locally. Version is checked as well if configured. |
| 936 | func (t *target) httpobjget(w http.ResponseWriter, r *http.Request) { |
| 937 | apireq := apiReqAlloc(2, apc.URLPathObjects.L, true /*dpq*/) |
| 938 | if err := t.parseReq(w, r, apireq); err != nil { |
| 939 | apiReqFree(apireq) |
| 940 | return |
| 941 | } |
| 942 | if err := apireq.dpq.fromRawQ(r.URL.RawQuery); err != nil { |
| 943 | debug.AssertNoErr(err) |
| 944 | t.writeErr(w, r, err) |
| 945 | return |
| 946 | } |
| 947 | if cmn.Features.IsSet(feat.EnforceIntraClusterAccess) { |
| 948 | if apireq.dpq.ptime == "" /*isRedirect*/ && t.isIntraCall(r.Header, false /*from primary*/) != nil { |
| 949 | t.writeErrf(w, r, "%s: %s(obj) is expected to be redirected (remaddr=%s)", |
| 950 | t.si, r.Method, r.RemoteAddr) |
| 951 | return |
| 952 | } |
| 953 | } |
| 954 | lom := cluster.AllocLOM(apireq.items[1]) |
| 955 | lom = t.getObject(w, r, apireq.dpq, apireq.bck, lom) |
| 956 | cluster.FreeLOM(lom) |
| 957 | apiReqFree(apireq) |
| 958 | } |
| 959 | |
| 960 | // getObject is main function to get the object. It doesn't check request origin, |
| 961 | // so it must be done by the caller (if necessary). |
no test coverage detected