1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
4 #ifndef RGW_ASIO_CLIENT_H
5 #define RGW_ASIO_CLIENT_H
7 #include <boost/asio/ip/tcp.hpp>
8 #include <boost/beast/core.hpp>
9 #include <boost/beast/http.hpp>
10 #include "include/ceph_assert.h"
12 #include "rgw_client_io.h"
17 namespace beast
= boost::beast
;
18 using parser_type
= beast::http::request_parser
<beast::http::buffer_body
>;
20 class ClientIO
: public io::RestfulClient
,
21 public io::BuffererSink
{
26 using endpoint_type
= boost::asio::ip::tcp::endpoint
;
27 endpoint_type local_endpoint
;
28 endpoint_type remote_endpoint
;
32 rgw::io::StaticOutputBufferer
<> txbuf
;
35 ClientIO(parser_type
& parser
, bool is_ssl
,
36 const endpoint_type
& local_endpoint
,
37 const endpoint_type
& remote_endpoint
);
40 int init_env(CephContext
*cct
) override
;
41 size_t complete_request() override
;
42 void flush() override
;
43 size_t send_status(int status
, const char *status_name
) override
;
44 size_t send_100_continue() override
;
45 size_t send_header(const std::string_view
& name
,
46 const std::string_view
& value
) override
;
47 size_t send_content_length(uint64_t len
) override
;
48 size_t complete_header() override
;
50 size_t send_body(const char* buf
, size_t len
) override
{
51 return write_data(buf
, len
);
54 RGWEnv
& get_env() noexcept override
{
62 #endif // RGW_ASIO_CLIENT_H