(r *http.Request)
| 78 | } |
| 79 | |
| 80 | func ParseRequestParam(r *http.Request) *RequestParam { |
| 81 | p := new(RequestParam) |
| 82 | p.r = r |
| 83 | p.vars = mux.Vars(r) |
| 84 | p.bucket = p.vars[ContextKeyBucket] |
| 85 | p.object = p.vars[ContextKeyObject] |
| 86 | p.accessKey = p.vars[ContextKeyAccessKey] |
| 87 | p.sourceIP = getRequestIP(r) |
| 88 | if len(p.bucket) > 0 { |
| 89 | p.resource = p.bucket |
| 90 | if len(p.object) > 0 { |
| 91 | if strings.HasPrefix(p.object, "/") { |
| 92 | p.resource = p.bucket + p.object |
| 93 | } else { |
| 94 | p.resource = p.bucket + "/" + p.object |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | p.action = GetActionFromContext(r) |
| 99 | if p.action.IsNone() { |
| 100 | p.action = ActionFromRouteName(mux.CurrentRoute(r).GetName()) |
| 101 | } |
| 102 | p.apiName = strings.TrimPrefix(string(p.action), proto.OSSActionPrefix) |
| 103 | |
| 104 | return p |
| 105 | } |
| 106 | |
| 107 | func (o *ObjectNode) getVol(bucket string) (vol *Volume, err error) { |
| 108 | if bucket == "" { |
no test coverage detected