const char *if_match,
const char *if_nomatch,
size_t *total_size,
+ size_t *obj_size,
void **handle,
struct rgw_err *err) = 0;
char *data;
void *handle;
off_t ofs = 0, end = -1;
- size_t total_len;
+ size_t total_len, obj_size;
time_t lastmod;
map<string, bufferlist> attrset;
ret = prepare_get_obj(src_obj, 0, &end, &attrset, mod_ptr, unmod_ptr, &lastmod,
- if_match, if_nomatch, &total_len, &handle, err);
+ if_match, if_nomatch, &total_len, &obj_size, &handle, err);
if (ret < 0)
return ret;
const char *if_match,
const char *if_nomatch,
size_t *total_size,
+ size_t *obj_size,
void **handle,
struct rgw_err *err)
{
free(etag);
- *total_size = (max_len > 0 ? max_len : 0);
+ if (total_size)
+ *total_size = (max_len > 0 ? max_len : 0);
+ if (obj_size)
+ *obj_size = size;
r = 0;
return r;
const char *if_match,
const char *if_nomatch,
size_t *size,
+ size_t *obj_size,
void **handle,
struct rgw_err *err);
obj.init(s->bucket_str, s->object_str);
ret = rgwstore->prepare_get_obj(obj, ofs, &end, &attrs, mod_ptr,
- unmod_ptr, &lastmod, if_match, if_nomatch, &total_len, &handle, &s->err);
+ unmod_ptr, &lastmod, if_match, if_nomatch, &total_len, &s->obj_size, &handle, &s->err);
if (ret < 0)
goto done;
- s->obj_size = total_len;
-
if (!get_data || ofs > end)
goto done;
int r = parse_range(range_str, ofs, end);
if (r < 0)
return r;
+ start = ofs;
}
if (if_mod) {
if (parse_time(if_mod, &mod_time) < 0)
rgw_obj obj(s->bucket_str, meta_oid, s->object_str, mp_ns);
int ret = rgwstore->prepare_get_obj(obj, 0, NULL, &attrs, NULL,
- NULL, NULL, NULL, NULL, NULL, &handle, &s->err);
+ NULL, NULL, NULL, NULL, NULL, NULL, &handle, &s->err);
rgwstore->finish_get_obj(&handle);
if (ret < 0)
off_t ofs;
size_t len;
size_t total_len;
+ off_t start;
off_t end;
time_t mod_time;
time_t lastmod;
if_unmod = NULL;
if_match = NULL;
if_nomatch = NULL;
+ start = 0;
ofs = 0;
len = 0;
total_len = 0;
int ret, r;
char *data;
off_t end = -1;
- size_t total_len;
+ size_t total_len, obj_size;
time_t lastmod;
map<string, bufferlist>::iterator iter;
rgw_obj tmp_obj = dest_obj;
map<string, bufferlist> attrset;
ret = prepare_get_obj(src_obj, 0, &end, &attrset,
- mod_ptr, unmod_ptr, &lastmod, if_match, if_nomatch, &total_len, &handle, err);
+ mod_ptr, unmod_ptr, &lastmod, if_match, if_nomatch, &total_len, &obj_size, &handle, err);
if (ret < 0)
return ret;
const char *if_match,
const char *if_nomatch,
size_t *total_size,
+ size_t *obj_size,
void **handle,
struct rgw_err *err)
{
if (total_size)
*total_size = (ofs <= *end ? *end + 1 - ofs : 0);
+ if (obj_size)
+ *obj_size = size;
if (lastmod)
*lastmod = mtime;
const char *if_match,
const char *if_nomatch,
size_t *total_size,
+ size_t *obj_size,
void **handle,
struct rgw_err *err);
FCGX_FFlush(s->fcgx->out);
}
-void dump_range(struct req_state *s, off_t ofs, off_t end)
+void dump_range(struct req_state *s, off_t ofs, off_t end, size_t total)
{
- CGI_PRINTF(s,"Content-Range: bytes %d-%d/%d\n", (int)ofs, (int)end, (int)end + 1);
+ CGI_PRINTF(s,"Content-Range: bytes %d-%d/%d\n", (int)ofs, (int)end, (int)total);
}
int RGWGetObj_REST::get_params()
extern void dump_etag(struct req_state *s, const char *etag);
extern void dump_last_modified(struct req_state *s, time_t t);
extern void abort_early(struct req_state *s, int err);
-extern void dump_range(struct req_state *s, off_t ofs, off_t end);
+extern void dump_range(struct req_state *s, off_t ofs, off_t end, size_t total_size);
extern void dump_continue(struct req_state *s);
extern void list_all_buckets_end(struct req_state *s);
extern void dump_time(struct req_state *s, const char *name, time_t *t);
goto send_data;
if (range_str)
- dump_range(s, ofs, end);
+ dump_range(s, ofs, start, s->obj_size);
dump_content_length(s, total_len);
dump_last_modified(s, lastmod);
goto send_data;
if (range_str)
- dump_range(s, ofs, end);
+ dump_range(s, start, end, s->obj_size);
dump_content_length(s, total_len);
dump_last_modified(s, lastmod);
int request_len = READ_CHUNK_LEN;
rgw_obj obj(bucket, key);
ret = rgwstore->prepare_get_obj(obj, 0, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, &handle, &err);
+ NULL, NULL, NULL, NULL, NULL, NULL, &handle, &err);
if (ret < 0)
return ret;