dout(0) << "curl_easy_perform returned error: " << error_buf << dendl;
ret = -EINVAL;
}
+ curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &http_status);
curl_easy_cleanup(curl_handle);
curl_slist_free_all(h);
bufferlist::iterator send_iter;
size_t send_len;
bool has_send_len;
+ long http_status;
rgw_http_req_data *req_data;
list<pair<string, string> > headers;
int init_request(const char *method, const char *url, rgw_http_req_data *req_data);
public:
- explicit RGWHTTPClient(CephContext *_cct): send_len (0), has_send_len(false), req_data(NULL), user_info(NULL), cct(_cct) {}
+ static const long HTTP_STATUS_NOSTATUS = 0;
+ static const long HTTP_STATUS_UNAUTHORIZED = 401;
+
virtual ~RGWHTTPClient();
+ explicit RGWHTTPClient(CephContext *_cct)
+ : send_len(0),
+ has_send_len(false),
+ http_status(HTTP_STATUS_NOSTATUS),
+ req_data(nullptr),
+ user_info(nullptr),
+ cct(_cct) {
+ }
void set_user_info(void *info) {
user_info = info;
has_send_len = true;
}
+ long get_http_status() const {
+ return http_status;
+ }
+
int process(const char *method, const char *url);
int process(const char *url) { return process("GET", url); }