]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_asio_client.h
update sources to v12.2.3
[ceph.git] / ceph / src / rgw / rgw_asio_client.h
index 513a3ef0ca20bc9e667ace39a015b871145e8123..038be51411c6a443bece5459fe878ab0e69880cf 100644 (file)
@@ -4,9 +4,8 @@
 #define RGW_ASIO_CLIENT_H
 
 #include <boost/asio/ip/tcp.hpp>
-#include <beast/http/message.hpp>
-#include <beast/http/message_parser.hpp>
-#include <beast/core/flat_streambuf.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/http.hpp>
 #include "include/assert.h"
 
 #include "rgw_client_io.h"
 namespace rgw {
 namespace asio {
 
-/// streaming message body interface
-struct streaming_body {
-  using value_type = boost::asio::mutable_buffer;
-
-  class reader {
-    value_type& buffer;
-   public:
-    using mutable_buffers_type = boost::asio::mutable_buffers_1;
-
-    static const bool is_direct{true}; // reads directly into user buffer
-
-    template<bool isRequest, class Fields>
-    explicit reader(beast::http::message<isRequest, streaming_body, Fields>& m)
-      : buffer(m.body)
-    {}
-
-    void init() {}
-    void init(uint64_t content_length) {}
-    void finish() {}
-
-    mutable_buffers_type prepare(size_t n) {
-      n = std::min(n, boost::asio::buffer_size(buffer));
-      auto position = boost::asio::buffer_cast<char*>(buffer);
-      return {position, n};
-    }
-
-    void commit(size_t n) {
-      buffer = buffer + n;
-    }
-  };
-};
-
-using header_type = beast::http::fields;
-using parser_type = beast::http::message_parser<true, streaming_body, header_type>;
+namespace beast = boost::beast;
+using parser_type = beast::http::request_parser<beast::http::buffer_body>;
 
 class ClientIO : public io::RestfulClient,
                  public io::BuffererSink {
@@ -55,10 +22,8 @@ class ClientIO : public io::RestfulClient,
   using tcp = boost::asio::ip::tcp;
   tcp::socket& socket;
   parser_type& parser;
-  beast::flat_streambuf& buffer; //< parse buffer
+  beast::flat_buffer& buffer; //< parse buffer
 
-  bool conn_keepalive{false};
-  bool conn_close{false};
   RGWEnv env;
 
   rgw::io::StaticOutputBufferer<> txbuf;
@@ -68,11 +33,9 @@ class ClientIO : public io::RestfulClient,
 
  public:
   ClientIO(tcp::socket& socket, parser_type& parser,
-           beast::flat_streambuf& buffer);
+           beast::flat_buffer& buffer);
   ~ClientIO() override;
 
-  bool get_conn_close() const { return conn_close; }
-
   void init_env(CephContext *cct) override;
   size_t complete_request() override;
   void flush() override;