]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: http_client: propagate send_data_hint differently
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 23 Jan 2019 23:41:44 +0000 (15:41 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 25 Jan 2019 23:45:57 +0000 (15:45 -0800)
Fixes: http://tracker.ceph.com/issues/36092
send_data_hint is passed so that the lower http client layer
to know in in cases where it's an http request that usually doesn't
send data (e.g., GET) that the request will actually send data,
and initialize the curl client correctly. In a case that was
used by the elasticsearch mechanism it wasn't passed correctly.
Now made it a data member in RGWHTTPClient, which also cleans
the interface a bit.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_http_client.cc
src/rgw/rgw_http_client.h
src/rgw/rgw_rest_client.cc
src/rgw/rgw_rest_client.h

index c2764b816ed4b1bdcf92aabb8c46bb7c65812ff7..50fe7915099faf64d85e16bd526050a942e0c095 100644 (file)
@@ -472,7 +472,7 @@ int RGWHTTPClient::get_req_retcode()
 /*
  * init request, will be used later with RGWHTTPManager
  */
-int RGWHTTPClient::init_request(rgw_http_req_data *_req_data, bool send_data_hint)
+int RGWHTTPClient::init_request(rgw_http_req_data *_req_data)
 {
   ceph_assert(!req_data);
   _req_data->get();
@@ -930,11 +930,11 @@ void RGWHTTPManager::manage_pending_requests()
   }
 }
 
-int RGWHTTPManager::add_request(RGWHTTPClient *client, bool send_data_hint)
+int RGWHTTPManager::add_request(RGWHTTPClient *client)
 {
   rgw_http_req_data *req_data = new rgw_http_req_data;
 
-  int ret = client->init_request(req_data, send_data_hint);
+  int ret = client->init_request(req_data);
   if (ret < 0) {
     req_data->put();
     req_data = NULL;
index ec5aa20a5722d52e5f79aecef23c9fe58cf1cce0..04d8506e3903d7aa0432048a883550abfe7bb465 100644 (file)
@@ -76,6 +76,7 @@ class RGWHTTPClient : public RGWIOProvider
   bufferlist::iterator send_iter;
   bool has_send_len;
   long http_status;
+  bool send_data_hint{false};
   size_t receive_pause_skip{0}; /* how many bytes to skip next time receive_data is called
                                    due to being paused */
 
@@ -87,6 +88,7 @@ class RGWHTTPClient : public RGWIOProvider
 
   std::atomic<unsigned> stopped { 0 };
 
+
 protected:
   CephContext *cct;
 
@@ -99,8 +101,7 @@ protected:
 
   RGWHTTPManager *get_manager();
 
-  int init_request(rgw_http_req_data *req_data,
-                   bool send_data_hint = false);
+  int init_request(rgw_http_req_data *req_data);
 
   virtual int receive_header(void *ptr, size_t len) {
     return 0;
@@ -165,6 +166,9 @@ public:
     has_send_len = true;
   }
 
+  void set_send_data_hint(bool hint) {
+    send_data_hint = hint;
+  }
 
   long get_http_status() const {
     return http_status;
@@ -347,7 +351,7 @@ public:
   int start();
   void stop();
 
-  int add_request(RGWHTTPClient *client, bool send_data_hint = false);
+  int add_request(RGWHTTPClient *client);
   int remove_request(RGWHTTPClient *client);
   int set_request_state(RGWHTTPClient *client, RGWHTTPRequestSetState state);
 };
index 5482a8f13d034f35ddb7a6cee518f74ae65fc288..daf6a24e53daa379017a9ec9e22d2abbfa18ff94 100644 (file)
@@ -761,7 +761,7 @@ int RGWRESTStreamRWRequest::do_send_prepare(RGWAccessKey *key, map<string, strin
   if (send_data) {
     set_send_length(send_data->length());
     set_outbl(*send_data);
-    send_data_hint = true;
+    set_send_data_hint(true);
   }
   
 
@@ -789,7 +789,7 @@ int RGWRESTStreamRWRequest::send(RGWHTTPManager *mgr)
     return RGWHTTP::send(this);
   }
 
-  int r = mgr->add_request(this, send_data_hint);
+  int r = mgr->add_request(this);
   if (r < 0)
     return r;
 
index 4ce188857a6ac0e28b93950ca5417b72a66d6286..8f9b2c16f546460d1b451b3795f96d90f5195a11 100644 (file)
@@ -161,7 +161,6 @@ public:
 };
 
 class RGWRESTStreamRWRequest : public RGWHTTPStreamRWRequest {
-  bool send_data_hint{false};
 protected:
   HostStyle host_style;
 public: