When reading request status, we need to check with req_data first,
since it might have failed before we even got the chance to set our
own status.
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
return done.read() != 0;
}
+ int get_retcode() {
+ Mutex::Locker l(lock);
+ return ret;
+ }
};
string RGWHTTPClient::to_str()
return method_str + " " + url_str;
}
+int RGWHTTPClient::get_req_retcode()
+{
+ if (!req_data) {
+ return -EINVAL;
+ }
+
+ return req_data->get_retcode();
+}
+
int RGWHTTPClient::init_request(const char *method, const char *url, rgw_http_req_data *_req_data)
{
assert(!req_data);
rgw_http_req_data *get_req_data() { return req_data; }
string to_str();
+
+ int get_req_retcode();
};
class RGWCompletionManager;
#define dout_subsys ceph_subsys_rgw
+int RGWRESTSimpleRequest::get_status()
+{
+ int retcode = get_req_retcode();
+ if (retcode < 0) {
+ return retcode;
+ }
+ return status;
+}
+
int RGWRESTSimpleRequest::receive_header(void *ptr, size_t len)
{
char line[len + 1];
map<string, string>& get_out_headers() { return out_headers; }
int get_http_status() { return http_status; }
- int get_status() { return status; }
+ int get_status();
};
}
int wait_bl(bufferlist *pbl) {
+ int ret = req.wait();
+ put();
+ if (ret < 0) {
+ return ret;
+ }
+
if (req.get_status() < 0) {
return req.get_status();
}